The terminal in your flavor of Linux comes with various useful commands to interact with your OS without a gui. In this post we will be providing a brief overview of practical & essential commands you can expect to use when working in a Linux environment. This list is intended to raise your awareness of useful commands in Linux. For more information on how to use a given command, you can reference an online version of man pages (manual pages) at https://linux.die.net/man/1/.

Looking to get a head start on your next software interview? Pickup a copy of the best book to prepare: Cracking The Coding Interview!

Buy Now On Amazon

cd/ls
When navigating your file system from the terminal, use cd to change directory, and ls to list what is in that directory.

mv/cp/rm
To move a file to another location or rename it, use the mv command. Use cp if you want to copy a file to another location. To delete a file or directory, you can use the rm command.

find/grep
The find command allows you to quickly find files on your system, while grep provides the ability to search for specific content in files.

ifconfig/netstat
For networking queries, we can use ifconfig to get the ip address bound to our interfaces. The netstat command allows you to view connections and network status, an is useful for identifying open ports.

ps/kill/top
Sometimes a process is taking up too much memory and needs to be killed. If you want to see the list of processes spawned by the terminal currently running you can use ps.  The kill command lets you terminate the running process using its process id. You can use top to view the resources (CPU/Memory) the processes running on your machine are taking, along with their process id.

cat/head/tail
If you need to display the contents of the file in the terminal itself, you can use cat to print the entire contents to the screen. If you would like to see just the beginning or ending portions of the file, you can use head and tail respectively.

chmod
If you need to change the permissions of a given file (read/write/execute), you can change it with chmod.

tar/zip
For file compression on linux it is common to (un)compressed using files the tar command, with the .tar or .tar.gz extensions. You can use zip to (un)compress .zip files.

screen
If you find yourself in need of an additional ‘screen’ to view/execute commands in, you can use the screen command.

 

The linux terminal is full of useful and powerful commands not mentioned in this article. If you want more information on a specific command cmd, try using the man keyword to view the man pages on that command and determine how to properly use it.

Contact Us