These 10 Linux Commands Will Make You More Efficient
As developers we spend a lot of time in our Terminals. The more efficient we are, the more time we have to do the things we love. In this article, I will share some of the most useful Linux commands that I use on a daily basis that will make your life easier.
This command will take you to the previous directory you were in. This is a great command to use when you are navigating through directories and you want to go back to the previous directory.
ctrl + r
This shortcut will allow you to search through your command history. This is a great command to use when you are trying to remember a command you used in the past.
ctrl + a
Rather than using the arrow keys to move your cursor to the beginning of the line, you can use this shortcut to move your cursor to the beginning of the line.
ctrl + e
Now that you are at the beginning of the line, you can use this shortcut to move your cursor to the end of the line. This come extremely handy when you are trying to edit a command.
This symbol will repeat the last command you ran. This command comes in handy when you forget to add
sudo to a command. You can simply run
sudo !! to run the last command with
This is a lesser known one, but it is extremely useful. This command will search through the manual pages for a given keyword.
ctrl + l
This one is pretty simple yet handy. This clears the terminal screen. This is great when you are trying to clear the screen and you don't want to use the
ctrl + U and
ctrl + K
Do not use the backspace key to delete parts of a command. Instead, use these shortcuts.
ctrl + U will delete everything before the cursor and
ctrl + K will delete everything after the cursor.
This command comes extremely handy when you are trying to search through a file. You can use
grep <keyword> <file> to search for a keyword in a file. You can also use grep with a pipe to search through the output of another command. For example,
ps aux | grep <keyword> will search through the output of the
ps aux command(which outputs all running processes). Or, you can use
ll | grep <keyword> to search through the output of the
ll command(which outputs all files in the current directory).
I use it every time when I need to monitor logs. This command will print the last 10 lines of a file and will continue to print new lines as they are added to the file.
- You can use
tail -f <file1> <file2>to monitor multiple files.
- You can use
tail -f <file> | grep <keyword>to monitor a file and filter the output by a keyword.
wc -l <file>will count the number of lines in a file.
df -hwill show you the disk usage of your system.
du -hwill show you the disk usage of the current directory.
ps auxwill show you all running processes.
manwill show you the manual page for a given command.
I hope you found these commands helpful. Bookmark this article and go through it every once in a while to refresh your memory. If you want to be even faster check out my article on Linux aliases.