In this article we will be discussing a few basic commands we could use in our daily server terminal interaction.
Generally Linux commands have the following syntax.
command [options] [arguments]
Each item is separated by space.
>> Options modify a commands behavior.
- Single letter options usually preceded by “ – ”
- Full word options usually preceded by “ — ”
>> Arguments are file names or other data needed by the command.
>> Multiple commands can be separated by “;”
Lets have a check with few of the most commonly used commands below:
man:
This is the command all Linux enthusiasts must know; “ man ” command will give you the detailed explanation of a command if there is a manual page associated with it. Man command which is short for manual
#man commandname
Try “man man” on your command line, isn’t it awesome
pwd:
A lot of commands on the terminal will rely on you being in the right location. As you’re moving around, it can be easy to lose track of where you are at. Make use of this command often so as to remind yourself where you presently are.
cd:
Change Directory :- this will help you to move around the directories. To move around more easily a few tricks are available
The Syntax is
cd [directory | ~ | ./ | ../ | – ]
[cd ~] : – this will take you to the home directory immediately wherever you are at the moment
[cd -] :- will teleport you to the previous working directory, avoiding hard work on typing the complete directory if you are lazy and helps you to find out where were you before.
ls:
List information about the files (the current directory by default). Sort entries alphabetically if no specific sorting arguments given with the command.
The Syntax is
ls [OPTIONS]… [FILE]
cat:
Cat command helps us to view the contents in a file, no edit options only can view.
Concatenate files and print on the standard output
The Syntax is
cat [OPTIONS] [FILE]…
chmod:
This command allows to change permission of a file or directory.
The Syntax is
chmod [options] [MODE] FileName
chown:
Used to change the ownership of a file or directory, only admin privileged user can change the ownerships.
The Syntax is
chown [options] newowner filename/directoryname
cp:
cp command copy files from one location to another. If the destination is an existing file, then the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).
The Syntax is
cp [OPTIONS]… SOURCE DESTINATION
cp [OPTIONS]… SOURCE… DIRECTORY
df:
df command is used to report how much free disk space is available for each mount you have. The first column show the name of the disk partition as it appears in the /dev directory. Subsequent columns show total space, blocks allocated and blocks available.
The Syntax is
df [options]
du:
du command is used to report how much disk space a file or directory occupies.
The Syntax is
du [options] directories
dig:
dig (Domain Information Groper) command is used in network administration. It is used to querying and display the server details of Domain Name System (DNS) name servers. dig is used for network troubleshooting.
The Syntax is
dig [ @server ] [ -b address ] [ -c class ] [ -f filename ] [ -k filename ] [ -p port# ] [ -t type ] [ -x addr ] [ -y name:key ] [ name ] [ type ] [ class ] [ queryopt… ]
dig [ -h ]
dig [ global-queryopt… ] [ query… ]
find:
find command finds one or more files assuming that you know their approximate filenames.
The Syntax is
find path [options]
free:
free command displays information about free and used memory on the system.
The Syntax is
free [options] [-V]
grep:
grep command selects and prints the lines from a file which matches a given string or pattern.
The Syntax is
grep [options] pattern [file]
kill:
kill command is used to kill the background process.
The Syntax is
kill [-s] [-l] %pid
who:
who command can list the names of users currently logged in, their terminal, the time they have been logged in, and the name of the host from which they have logged in.
The Syntax is
who [options] [file]
top:
Linux Top command is a performance monitoring program which is used frequently by many system administrators to monitor Linux performance and it is available under many Linux/Unix like operating systems.It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more. It also shows high memory and cpu utilization of a running processes.
syntax : top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b]
vmstat:
Linux VmStat command used to display statistics of virtual memory, kernel threads, disks, system processes, I/O blocks, interrupts and CPU activity.
syntax : vmstat [-a] [-n] [delay [ count]]
-a : switch displays active/inactive memory
-n : switch causes the header to be displayed only once rather than periodically
lsof:
Lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices and processes.
syntax : lsof /file/path
tcpdump:
Tcpdump one of the most widely used command-line network packet analyzer or packets sniffer program that is used capture or filter TCP/IP packets that received or transferred on a specific interface over a network.
The Syntax is
tcpdump -i <interface>
netstat :
Netstat is a command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics. It is very useful tool for every system administrator to monitor network performance and troubleshoot network related problems.
The Syntax is
netstat [options]
htop:
Htop is a much advanced interactive and real time Linux process monitoring tool. This is much similar to Linux top command but it has some rich features like user friendly interface to manage process, shortcut keys, vertical and horizontal view of the processes.
The Syntax is
htop [-dChusv]
iotop:
Iotop is also much similar to top command and Htop program, but it has accounting function to monitor and display real time Disk I/O and processes.
iotop [options]
iostat:
IoStat is simple tool that will collect and show system input and output storage device statistics. This tool is often used to trace storage device performance issues including devices, local disks, remote disks such as NFS.
iostat [ -c | -d ] [ -k ] [ -t ] [ -V ] [ -x ] [ { device [ … ] | ALL } ] [ -p [ { device | ALL } ] ] [ interval [ count ] ]
If you require help, contact SupportPRO Server Admin


