Linux Command Line (Basic Commands)

Tags Linux

Linux Command Line - Common Commands

The following are some basic commands that are necessary to interact with files, folders, and applications on the Linux CLI (command line). Keep in mind that capitalization counts!

This list is not comprehensive and is just meant to be a starting point.

There are several online Linux resources you may find helpful, just search and find one you prefer.

Command Summary

Command Description Syntax / Common Examples
cat Prints the contents of one or more files to the screen. cat filename
cat file1 file2
cd Changes the current working directory.
No argument → goes to home directory (~).
cd directoryname
cd .. (go up one level)
cd (go home)
cd ~ (go home)
cp Copies files or directories.
Use -r for recursive copy of directories.
cp sourcefile targetfile
cp -r sourcedir targetdir
du Estimates and displays disk usage.
Use -h for human-readable sizes.
du -h /home/chad.julius
du -h --max-depth=1 /home/chad.julius
less Views file contents one page at a time (arrow keys, Page Up/Down, q to quit). less filename
ls / ll Lists files and directories.
ll usually shows long format.
ls
ls -l (long format)
ls -a (show hidden files)
man Displays the manual/help page for a command. man ls
man cp
mkdir Creates one or more new directories. mkdir newfolder
mkdir dir1 dir2
mv Moves or renames files/directories.
If target is a directory → moves into it.
mv oldname newname
mv file1 file2 dir/
pwd Prints the full path of the current working directory. pwd
rm Removes (deletes) files.
Use -r to remove directories recursively.
rm file.txt
rm -r directory
rmdir Removes empty directories only (safer than rm -r). rmdir emptydir
scp Securely copies files/directories to/from a remote server (SSH). scp file.txt user@remote:/path/
scp -r dir/ user@remote:/path/
tail Displays the last few lines of a file (great for logs). tail filename
tail -n 20 logfile.log

Quick Tips

  • Get help: Use man command (e.g. man ls) or command --help for a quick summary of options.
  • Combine commands: Many commands accept multiple files at once.
    Example: cp file1 file2 file3 dest/
  • Be careful with rm: There is no "recycle bin" — deleted files are usually gone forever.
  • Hidden files: Use ls -a to see dotfiles (e.g. .bashrc, .ssh/, etc.).
  • Recursive operations: Use the -r or -R flag with cp, rm, scp when working with directories.

These commands will handle ~80% of day-to-day file and directory tasks. Practice them in a safe directory!

Happy commanding!

Was this helpful?
0 reviews