Common command line operations

karthik · updated · flag

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.


Comments