List of useful Linux commands

This post provides a general overview about useful Linux commands to achieve various goals. Some of the commands are described in more details in other posts. Please note that this post is extended over time.

Navigation

This section covers commands which are used to navigate through the directory structure.

CommandExplanation
pwdshows the full path of the current location
cdchange the current location/directory

Usage Examples:

~ $ pwd
/home/user1
~ $ cd ..
/home $ cd /var/lib/jenkins
/var/lib/jenkins $ cd ../..
/var $ cd /
/ $ cd ~
~ $ pwd
/home/user1
~ $

Explanation:

Shortcut/PatternExplanation
..One directory up in the hierachy, can be used cumulative
/root of the directory structure
~home directory of the current user

Viewing and editing files

This section provides an overview of commands for viewing and modifying files.

CommandCommon OptionsExplanation
tail-n (number)shows the end of a file, can be used with -n option to give the number of lines to be shown
vibasic editor for shell (more details)
nanoanother editor which is easier to use without deeper knowledge
seda stream editor which can be used to automate file manipulations (e.g. regex replace)

Network protocols

This section provides an overview of commands for communication over the network.

CommandExplanation
curlpowerful tool for sending http requests
ftpexchanging files via ftp protocol
sshremote login tool to other servers via ssh protocol
scpcommand for exchanging files via ssh protocol

System Resources

CommandCommon optionsExplanation
topTool to view processes and resource consumption, e.g. cpu, memory (more details)
df-hdf (disk free) shows details about the free space on mounted drives (more details)
du-hadu (disk usage) shows details about space usage for directories and files (more details)
free-m ( -g)shows statistics for Memory and swap, -m in mega byte, -g in giga byte

Leave a Reply

Your email address will not be published. Required fields are marked *