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.
Command | Explanation |
pwd | shows the full path of the current location |
cd | change 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/Pattern | Explanation |
.. | 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.
Command | Common Options | Explanation |
tail | -n (number) | shows the end of a file, can be used with -n option to give the number of lines to be shown |
vi | basic editor for shell (more details) | |
nano | another editor which is easier to use without deeper knowledge | |
sed | a 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.
Command | Explanation |
curl | powerful tool for sending http requests |
ftp | exchanging files via ftp protocol |
ssh | remote login tool to other servers via ssh protocol |
scp | command for exchanging files via ssh protocol |
System Resources
Command | Common options | Explanation |
top | Tool to view processes and resource consumption, e.g. cpu, memory (more details) | |
df | -h | df (disk free) shows details about the free space on mounted drives (more details) |
du | -ha | du (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