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.
Navigation¶
Command |
Description |
pwd |
Print working directory - shows you the path of the current directory in the terminal. |
ls |
List the contents of the directory you are in. Add an argument -a to view everything including hidden files. |
cd |
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 cd ~ . |
cd .. |
Change to the parent directory. |
cd - |
Change to the previous directory. |
File handling¶
Command |
Description |
cp |
Copy a file from source path to destination path. Example - cp /sourcedir/abc.txt /destinationdir/xyz.txt |
mv |
Move a file from source path to destination path. |
rm |
Remove a file from the given path. Example - rm /home/abc.txt . |
mkdir |
Create a new directory under the specified path. Example - /home/newdir/ |
rmdir |
Remove the directory under the specified path. |
cat |
Display file contents in the terminal. Example - cat /someserver/access.log |
> |
Redirect content from LHS file to RHS file. Usage - cat /abc.txt > /xyz.txt . This command redirects the output of abc.txt to xyz.txt . |
>> |
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 xyz.txt . |
| |
Pipe the output of LHS command to the RHS command. |
tail |
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¶
Command |
Description |
netstat |
Network statistic command that displays the information of your network parameters. |
ifconfig |
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. |
traceroute |
Trace the route taken by a network call to a website or IP. Usage - traceroute mindspace.arclind.com . |
ssh |
Secure Shell protocol command that lets you login to a remote terminal of a server over a secure connection. Usage - ssh user@host . |
curl |
A command-line utility with so many features used to transfer data from or to a server with various protocols. |
karthiknedjam - Each one of these commands … ·
Hey nedjam. Welcome to Mindspace. And yes! :) I’ve been considering writing some crash courses on some frequently used commands. If you’ve got one in your mind, please do the honours.
nedjam ·
Each one of these commands can have a crash course on its own. It could be a good alternative for man pages. Think about it.