As a Linux user, even if you’re using the GUI, you’d eventually be seduced by the productive edge of the CLI and end up using it more often. And very soon you’d start a new life inside a terminal. But everyone has to start somewhere. So here are the basic commands that’ll help you ease into the world of terminal control. Most commands are self-explanatory and you should be able to pick it up quick.
|Print working directory - shows you the path of the current directory in the terminal.
|List the contents of the directory you are in. Add an argument
-a to view everything including hidden files.
|Change directory - changes your path to a directory you specify. Example -
cd /home changes your current directory to your home directory. For root directory, use
|Change to the parent directory.
|Change to the previous directory.
|Copy a file from source path to destination path. Example -
cp /sourcedir/abc.txt /destinationdir/xyz.txt
|Move a file from source path to destination path.
|Remove a file from the given path. Example -
|Create a new directory under the specified path. Example -
|Remove the directory under the specified path.
|Display file contents in the terminal. Example -
|Redirect content from LHS file to RHS file. Usage -
cat /abc.txt > /xyz.txt. This command redirects the output of
|Append content from LHS file to RHS file. Usage -
cat /abc.txt >> /xyz.txt. This command appends the output of
abc.txt to the existing content in
|Pipe the output of LHS command to the RHS command.
|Display just the last 10 lines of a file in the terminal. Example -
tail /someserver/access.log. You can increase the number of lines by passing it as an argument like
tail -30 /somefile.
|Network statistic command that displays the information of your network parameters.
|Interface configuration command that displays the information of all the network interfaces in a system. Useful to identify the interface names and their MTU values.
|Trace the route taken by a network call to a website or IP. Usage -
|Secure Shell protocol command that lets you login to a remote terminal of a server over a secure connection. Usage -
|A command-line utility with so many features used to transfer data from or to a server with various protocols.