Linux | Shell Basics
Some of the most common Linux commands and their usages listed in the table below. Commands are sorted based on popularity whereas shortcuts are sorted alphabetically.
1. Basic Symbols
Symbol | Usage |
| Used to denote following directories in the root tree
|
| Shortcut for the home directory -
|
| Stands for the current directory you are located in
|
| Stands for the parent directory (one directory up in the tree)
|
| Stands for the recent directory located (or flags see below)
|
| Used to skip characters if the name includes a space
|
| Used as a wildcard during searches - matches one of more occurrences of any character, including no character
|
| Used as a wildcard to represent an anonymous character
|
| Used as a wildcard to represent a character between brackets
|
| Characters after a dash symbol following a command stands for options (flags) for that command to be executed
|
| Absolute path of a file from the root folder - always works! |
| Relative path to a file relative to the current directory
|
2. Navigation Commands
Command | Usage |
| Prints working directory (absolute path) |
| Changes directory to dir (folder)
|
| Lists all (excluding hidden) files in a given / current dir
|
| Opens the user manual for the command |
| Opens the help page for the command |
| Prints the time it takes to execute the command |
| Prints the last commands typed on the terminal |
| Clears the terminal page (Ctrl+L) |
| Concatenate - Multiple purpose |
| Displays the type of file given with filename |
| Locates (searches for) the file in the Linux system |
| Shuts down the system at a given time
|
| Stops and restarts the system |
| Resets the terminal screen |
| Logs out of terminal (Ctrl+D) |
| Zipping files and folder - (password protected)
|
3. Displaying System Information
Command | Usage |
| Displays the online user information |
| Displays the current username |
| Prints the full date with other details
|
| Displays the monthly calendar |
| Displays user information |
| Shows directory space usage |
| Shows a report on the disk space usage |
| Displays the location of the application |
| Displays the default version of the app |
4. Displaying File Contents
Command | Usage |
| Prints the string |
| Prints the contents of the file |
| Opens the file in the given path |
| Displays the contents of the file
|
| Displays the contents of the given file
|
| Displays the first |
| Displays the last |
| Searches (filters) for the content in the text file |
| Sorts the contents of the file |
| Displays the number of words (word count) in the file |
5. Manipulating Files
Command | Usage |
| Makes directory with the given name |
| Moves the given file to the given directory
|
| Removes the given file - cannot be undone
|
| Removes the given directory if it is empty |
| Creates a new file or files - file 1 (and file 2) |
| Copies the given file with a given new name
|
| Cuts a specific part of the file |
| Creates a physical / symbolic (
|
| Redirects (STDOUT) output of file 1 to (STDIN) input of file 2 |
| Saves/redirects the (STDOUT) output of file 1 to file 2
|
| Appends (STDOUT) output of file 1 to file 2 - w/o overwriting |
| Redirects the (STDERR) error message of file 1 to file 2 |
| Passes the contents of the file 2 (STDIN) to a program |
6. Terminal Shortcuts
Shortcut | Usage |
| Moves the cursor to the beginning of the line |
| Moves the cursor back one character at a time |
| Terminates the current running process |
| Exits the bash shell - same with Also removes the character under the cursor while typing |
| Moves the cursor to the ending of the line |
| Moves the cursor forward one character at a time |
| Removes all the text from the cursor until the end of the line |
| Clears the terminal (Moves the previous commands up) |
| Unfreezes the terminal (doesn't work in MacOS) |
| Freezes the terminal (doesn't work in MacOS) |
| Removes all the text from the cursor to the beginning
|
| Pauses the current running process |
| Moves the cursor back one word at a time |
| Moves the cursor forward one word at a time |
| Use |
⇧ | ⇩ | Use arrows to display previously typed commands |
References:
0) https://ubuntu.com/tutorials/command-line-for-beginners#1-overview
1) The Linux Command Line by William Shotts
2) https://www.pluralsight.com/guides/beginner-linux-navigation-manual
3) https://ryanstutorials.net/linuxtutorial/
4) https://maker.pro/linux/tutorial/basic-linux-commands-for-beginners
5) https://www.tecmint.com/linux-command-line-bash-shortcut-keys/
Last updated