Basic Linux Commands for Beginners
27
6
By Alok Naushad
What is Linux?
Linux is an Operating System’s Kernel. You might have heard of UNIX. Well, Linux is a UNIX clone. But it was actually created by Linus Torvalds from Scratch. Linux is free and open-source, that means that you can simply change anything in Linux and redistribute it in your own name! There are several Linux Distributions, commonly called “distros”. A few of them are:
Ubuntu Linux
Red Hat Enterprise Linux
Linux Mint
Debian
Fedora
Linux is Mainly used in Servers. About 90% of the Internet is powered by Linux Servers. This is because Linux is fast, secure, and free! The main problem of using Windows Servers are their cost. This is solved by using Linux Servers. Forgot to mention, the OS that runs in about 80% of the Smartphones in the World, Android, is also made from the Linux Kernel. Yes, Linux is amazing! A simple example of its security is that most of the viruses in the world run on Windows, but not on Linux!
Linux Shell or “Terminal”
So, basically, Shell is a program that receives commands from the user and gives it to the OS to process and it shows the output. Linux’s shell is its main part. Its distros come in GUI(Graphical User Interface) but basically, Linux has a CLI (Command Line Interface). In this tutorial, we are going to cover the Basic Commands that we use in the Shell of Linux.
We can open the terminal by Ctrl+Alt+T in Ubuntu, or by pressing Alt+F2 and then typing in gnome-terminal and press Enter. In raspberry Pi, it is lxterminal that we should type in. There is also a GUI way of taking it, but this is better!
Linux Commands
Basic Commands
1. pwd
When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the Absolute Path, which means the path that starts from the root. The root is the base of the Linux filesystem. It is denoted by a forward slash( / ). The user directory is usually something like /home/username.
2. ls
The “Is” command is used to know what files are there in the directory you are in. You can see all the hidden files by using the command “ls -a”.
3. cd
“cd” is the command used to go to a directory. For example, if you are in the home folder, and you want to go to the Downloads folder, then you can type in “cd Downloads”. Remember, this command is case sensitive and you have to type in the name of the folder exactly as it is. But there is a problem with these commands. Imagine you have a folder named “Raspberry Pi”. In this case, when you type in “cd Raspberry Pi”, the shell will take the second argument of the command as a different one, so you will get an error saying that the directory does not exist. Here, you can use a backward slash. That is, you can use “cd Raspberry\ Pi” in this case. Spaces are denoted like this: If you just type “cd” and press Enter, it takes you to the home directory. To go back from a folder to the folder before that, you can type “cd ..” . The two dots represent back.
4. mkdir & rmdir
The mkdir command is used when you need to create a folder or a directory. For Example, if you want to make a directory called “DIY”, then you can type “mkdir DIY”. Remember, as told before, if you want to create a directory named “DIY Hacking”, then you can type “mkdir DIY\ Hacking”.
rmdir is the command used for deleting a directory. But, rmdir can only be used to delete an empty directory. To delete a directory containing files, rm is used.
5. rm
The rm command is used to delete files and directories. rm cannot simply delete a directory. “rm -r” is used to delete a directory. In this case, it deletes both the folder and the files in it.
6. touch
The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file. For example – “touch new.txt”
7. man & –help
To know more about a command and on how to use it, the man command is used. It shows the manual pages of the command. For Example, “man cd” shows the manual pages of the cd command. Typing in the command name and the argument helps it show which ways the command can be used (Example – cd –help).
8. cp
The cp command is used to copy files through the command line. It takes two arguments, the first one is location of the file to be copied, the second iswhere to copy.
9. mv
The mv command is used to move files through the command line. We can also use the mv command to rename a file. For example, if we want to rename the file “text” to “new”, we can use “mv text new”. It takes the two arguments just like the cp command.
10. locate
The locate command is used to locate a file in a Linux System, just like the search command in Windows. This command is useful when you don’t know where a file is saved or the actual name of the file. Using the –i argument with the command, helps to ignore the case (it doesn’t matter if it is Capital or Small). So, if you want a file that has the word “hello”, it gives the list of all the files in your Linux System containing the word “hello” when you type in “locate -i hello”. If you remember two words, you can separate it using asterisk (*). For example, to locate a file containing the words “hello” and “this”, you can use the command “locate –i *hello*this ”
Intermediate Commands
1. echo
“echo” is a command that helps us move some data, usually text into a file. For example, if you want to create a new text file or add into an already made text file, then you just need to type in “echo hello, my name is alok >> new.txt”. You do not need to separate the spaces by using the backward slash here because we put in two triangular brackets when we finish what we need to write.
2. cat
The cat command is used to display the contents of a file, usually used to easily view programs.
3. nano, vi, jed
nano and vi are already installed text editors in the Linux command line. nano is a good text editor which denotes keywords with color and can recognize most of the languages. Vi is simpler than nano. You can create a new file or modify one using this editor. For example, if you need to make a new file named “check.txt”, you can create it by using the command “nano check.txt”. You can save your files after editing by using the sequence, Ctrl+X, then Y (or N for no). In my experience, using nano for HTML editing doesn’t seem so good, because of its color, so I recommend jed text editor. We will come to installing packages soon.
4. sudo
sudo is a widely used command in the Linux command line. sudo stands for “SuperUser Do”. So, if we want any command to be done with administrative or root privileges, then you can use the sudo command. For Example, if you want to edit a file like viz. alsa-base.conf which needs root permissions, you can use the command – sudo nano alsa-base.conf . You can enter the root command line using the command “sudo bash”, then type in your user password. You can also use the command “su” to do this, but you need to set a root password before that. For that, you can use the command “sudo passwd”(it wasn’t misspelled, it is passwd). Then type in the new root password.
5. df
The df command is used to see the available disk space in each of the partitions in your system. You can just type in df in the command line and you can see each mounted partition and their used/available space in % and in KBs. If you want it shown in megabytes, you can use the command “df -m”
6. du
du is a command to know the disk usage of a file in your System. If you want to know the disk usage for a particular folder or file in Linux, then you can type in the command df and the name of the folder or file. For example, if you want to know the disk space used by the folder Documents in Linux, you can use the command “du Documents”. You can also use the command “ls -lah” to view the file sizes of all the files in a folder.
7. tar
tar is a command used to work with tarballs (or files compressed in a tarball archive) in the Linux Command Line. It has a long list of uses. It can be used to compress and uncompress different types of tar archives like .tar, .tar.gz, .tar.bz2.etc. It works on the basis of the arguments given to it. For example, tar -cvf for creating a .tar archive, -xvf to untar a tar archive, -tvf to list the contents of the archive.etc. As it is a wide topic, here are some examples of tar commands.
8. zip, unzip
zip is a command used to compress files into a zip archive, unzip is used to extract files from a zip archive.
9. uname
uname is a command used to show the Information about the system your Linux distro is running. Using the command “uname -a” prints most of the information about the system. This prints the Kernel release date, version, processor type. etc.
10. apt-get
apt is a command used to work with packages in the Linux command line. apt-get is a command used to install packages. This requires root privileges, so we use the sudo command with it. For example, if we want to install the text editor jed (as I mentioned earlier), we can type in the command “sudo apt-get install jed”. Similarly, any packages can be installed like this. It is good to update your repository each time you try to install a new package. You can do that by typing “sudo apt-get update”. You can upgrade the system by typing “sudo apt-get upgrade”. We can also upgrade the distro by typing “sudo apt-get dist-upgrade”. The command “apt-cache search” is used to search for a package. If you want to search for one, you can type in “apt-cache search jed”(This doesn’t require root).
11. chmod
chmod is the command used to make a file executable and to change the permissions granted to it in Linux. Imagine you have a python code named numbers.py in your computer, you’ll need to run “python numbers.py” every time you need to run it. Instead of that, when you make it executable, you’ll just need to run “numbers.py” in the terminal to run the file. To make a file executable, you can use the command “chmod +x numbers.py” in this case. You can use “chmod 755 numbers.py” to give it root permissions or “sudo chmod +x numbers.py” for root executable. Here is some more information about the chmod command.
12. hostname
hostname is a command used to know your name in your host or your network. Basically, it displays your hostname and IP address. Typing just “hostname” gives the output, your hostname. Typing in “hostname -I” gives you your IP address in your network.
13. ping
ping is a command used to check your connection to a server. Wikipedia says that “Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network”. Simply, when you type in, for example, “ping google.com”, it checks if it can connect to the server and come back. It measures this round-trip time and gives you the details about it. The use of this command for simple users like us is to check your internet connection. If it pings the Google server (in this case), you can confirm that your internet connection is active!
Tips and Tricks in Using Linux Command Line
You can use clear command to clear the terminal if it gets filled up with too many commands!
TAB can be used to fill up in Terminal. For example, You just need to type “cd Doc” and then TAB and the terminal fills the rest up and makes it “cd Documents”.
Ctrl+C can be used to stop any command in terminal safely. If it doesn’t stop with that, then Ctrl+Z can be used to force stop it.
You can exit from the terminal by using the exit command.
You can power off or reboot the computer by using the command sudo halt and sudo reboot.
Important Linux Commands
This section gives insight into the most important commands of your SuSE Linux system. Along with the individual commands, parameters are listed and, where appropriate, a typical sample application is introduced. To learn more about the various commands, it is usually possible to get additional information with the man program followed by the name of the command, for example, man ls.
In these manual pages, move up and down with PgUp and PgDn and move between the beginning and the end of a document with Home and End. End this viewing mode by pressing Q. Learn more about the man command itself with man.
There are many more commands than listed in this chapter. For information about other commands or more detailed information, we recommend the O'Reilly publication Linux in a Nutshell. In the following overview, the individual command elements are written in different typefaces.
The actual command is always printed as command. Without this, nothing can function.
Options without which the respective program cannot function are printed in italics.
Further details, like file names, which must be passed to a command for correct functioning, are written in the Courier font.
Specifications or parameters that are not required are placed in [brackets].
Adjust possible specifications to your needs. It makes no sense to write ls file(s), if no file named file(s) actually exists. You can usually combine several parameters, for example, by writing ls -la instead of ls -l -a.
File Commands
File Administration
ls [option(s)] [file(s)]
If you run ls without any additional parameters, the program will list the contents of the current directory in short form.
-l
detailed list
-a
displays hidden files
cp [option(s)] sourcefile targetfile
Copies sourcefile to targetfile.
-i
Waits for confirmation, if necessary, before an existing targetfile is overwritten
-r
Copies recursively (includes subdirectories)
mv [option(s)] sourcefile targetfile
Copies sourcefile to targetfile then deletes the original sourcefile.
-b
Creates a backup copy of the sourcefile before moving
-i
Waits for confirmation, if necessary, before an existing targetfile is overwritten
rm [option(s)] file(s)
Removes the specified files from the file system. Directories are not removed by rm unless the option -r is used.
-r
Deletes any existing subdirectories
-i
Waits for confirmation before deleting each file.
ln [option(s)] sourcefile targetfile
Creates an internal link from the sourcefile to the targetfile, under a different name. Normally, such a link points directly to the sourcefile on one and the same file system. However, if ln is executed with the -s option, it creates a symbolic link that only points to the directory where the sourcefile is located, thus enabling linking across file systems.
-s
Creates a symbolic link
cd [options(s)] [directory]
Changes the current directory. cd without any parameters changes to the user's home directory.
mkdir [option(s)] directoryname
Creates a new directory.
rmdir [option(s)] directoryname
Deletes the specified directory, provided it is already empty.
chown [option(s)] username.group file(s)
Transfers the ownership of a file to the user with the specified user name.
-R
Changes files and directories in all subdirectories.
chgrp [option(s)] groupname file(s)
Transfers the group ownership of a given file to the group with the specified group name. The file owner can only change group ownership if a member of both the existing and the new group.
chmod [options] mode file(s)
Changes the access permissions.
The mode parameter has three parts: group, access, and access type. group accepts the following characters:
u
user
g
group
o
others
For access, access is granted by the + symbol and denied by the - symbol.
The access type is controlled by the following options:
r
read
w
write
x
eXecute — executing files or changing to the directory.
s
Set uid bit — the application or program is started as if it were started by the owner of the file.
gzip [parameters] file(s)
This program compresses the contents of files, using complex mathematical algorithms. Files compressed in this way are given the extension .gz and need to be uncompressed before they can be used. To compress several files or even entire directories, use the tar command.
-d
decompresses the packed gzip files so they return to their original size and can be processed normally (like the command gunzip).
tar options archive file(s)
The tar puts one file or (usually) several files into an archive. Compression is optional.
tar is a quite complex command with a number of options available. The most frequently used options are:
-f
Writes the output to a file and not to the screen as is usually the case
-c
Creates a new tar archive
-r
Adds files to an existing archive
-t
Outputs the contents of an archive
-u
Adds files, but only if they are newer than the files already contained in the archive
-x
Unpacks files from an archive (extraction)
-z
Packs the resulting archive with gzip
-j
Compresses the resulting archive with bzip2
-v
Lists files processed
The archive files created by tar end with .tar. If the tar archive was also compressed using gzip, the ending is .tgz or .tar.gz. If it was compressed using bzip2, .tar.bz2.
Application examples can be found in Section “Archives and Data Compression”.
locate pattern(s)
The locate command can find in which directory a specified file is located. If desired, use wild cards to specify file names. The program is very speedy, as it uses a database specifically created for the purpose (rather than searching through the entire file system). This very fact, however, also results in a major drawback: locate is unable to find any files created after the latest update of its database.
The database can be generated by root with updatedb.
updatedb [options(s)]
This command performs an update of the database used by locate. To include files in all existing directories, run the program as root. It also makes sense to place it in the background by appending an ampersand (&), so you can immediately continue working on the same command line (updatedb &).
find [option(s)]
The find command allows you to search for a file in a given directory. The first argument specifies the directory in which to start the search. The option -name must be followed by a search string, which may also include wild cards. Unlike locate, which uses a database, find scans the actual directory.
Commands to Access File Contents
cat [option(s)] file(s)
The cat command displays the contents of a file, printing the entire contents to the screen without interruption.
-n
Numbers the output on the left margin
less [option(s)] file(s)
This command can be used to browse the contents of the specified file. Scroll half a screen page up or down with PgUp and PgDn or a full screen page down with Space. Jump to the beginning or end of a file using Home and End. Press Q to exit the program.
grep [option(s)] searchstring filenames
The grep command finds a specific searchstring in the specified file(s). If the search string is found, the command displays the line in which the searchstring was found along with the file name.
-i
Ignores case
-l
Only displays the names of the respective files, but not the text lines
-n
Additionally displays the numbers of the lines in which it found a hit
-l
Only lists the files in which searchstring does not occur
diff [option(s)] file1 file2
The diff command compares the contents of any two files. The output produced by the program lists all lines that do not match.
This is frequently used by programmers who need only send their program alterations and not the entire source code.
-q
Only reports whether the two given files differ
File Systems
mount [option(s)] [<device>] mountpoint
This command can be used to mount any data media, such as hard disks, CD-ROM drives, and other drives, to a directory of the Linux file system.
-r
mount read-only
-t filesystem
Specifies the file system. The most common are ext2 for Linux hard disks, msdos for MS-DOS media, vfat for the Windows file system, and iso9660 for CDs.
For hard disks not defined in the file /etc/fstab, the device type must also be specified. In this case, only root can mount. If the file system should also be mounted by other users, enter the option user in the appropriate line in the /etc/fstab file (separated by commas) and save this change. Further information is available in mount.
umount [option(s)] mountpoint
This command unmounts a mounted drive from the file system. To prevent data loss, run this command before taking a removable data medium from its drive. Normally, only root is allowed to run the commands mount and umount. To enable other users to run these commands, edit the /etc/fstab file to specify the option user for the respective drive.
System Commands
System Information
df [option(s)] [directory]
The df (disk free) command, when used without any options, displays information about the total disk space, the disk space currently in use, and the free space on all the mounted drives. If a directory is specified, the information is limited to the drive on which that directory is located.
-H
shows the number of occupied blocks in gigabytes, megabytes, or kilobytes — in human-readable format
-t
Type of file system (ext2, nfs, etc.)
du [option(s)] [path]
This command, when executed without any parameters, shows the total disk space occupied by files and subdirectories in the current directory.
-a
Displays the size of each individual file
-h
Output in human-readable form
-s
Displays only the calculated total size
free [option(s)]
The command free displays information about RAM and swap space usage, showing the total and the used amount in both categories.
-b
Output in bytes
-k
Output in kilobytes
-m
Output in megabytes
date [option(s)]
This simple program displays the current system time. If run as root, it can also be used to change the system time. Details about the program are available in date.
Processes
top [options(s)]
top provides a quick overview of the currently running processes. Press H to access a page that briefly explains the main options to customize the program.
ps [option(s)] [process ID]
If run without any options, this command displays a table of all your own programs or processes — those you started. The options for this command are not preceded by hyphen.
aux
Displays a detailed list of all processes, independent of the owner.
kill [option(s)] process ID
Unfortunately, sometimes a program cannot be terminated in the normal way. However, in most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps).
kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used:
-9
Sends a KILL signal instead of a TERM signal, with which the process really is annihilated by the operating system. This brings the specific processes to an end in almost all cases.
killall [option(s)] processname
This command is similar to kill, but uses the process name (instead of the process ID) as an argument, causing all processes with that name to be killed.
Network
ping [option(s)] host name|IP address
The ping command is the standard tool for testing the basic functionality of TCP/IP networks. It sends a small data packet to the destination host, requesting an immediate reply. If this works, ping displays a message to that effect, which indicates that the network link is basically functioning.
-c
number Determines the total number of packages to send and ends after they have been dispatched. By default, there is no limitation set.
-f
flood ping: sends as many data packages as possible. A popular means, reserved to root, to test networks.
-i
value Specifies the interval between two data packages in seconds. Default: one second
nslookup
The Domain Name System resolves domain names to IP addresses. With this tool, send queries to information servers (DNS servers).
telnet [option(s)] host name or IP address
Telnet is actually an Internet protocol that enables you to work on remote hosts across a network. telnet is also the name of a Linux program that uses this protocol to enable operations on remote computers.
Warning
Do not use telnet over a network on which third parties can eavesdrop. Particularly on the Internet, use encrypted transfer methods, such as ssh, to avoid the risk of malicious misuse of a password (see the man page for ssh).
Miscellaneous
passwd [option(s)] [username]
Users may change their own passwords at any time using this command. Furthermore, the administrator root can use the command to change the password of any user on the system.
su [option(s)] [username]
The su command makes it possible to log in under a different user name from a running session. When using the command without specifying a user name, you will be prompted for the root password. Specify a user name and the corresponding password to use the environment of the respective user. The password is not required from root, as root is authorized to assume the identity of any user.
halt [option(s)]
To avoid loss of data, you should always use this program to shut down your system.
reboot [option(s)]
Does the same as halt with the difference that the system performs an immediate reboot.
clear
This command cleans up the visible area of the console. It has no options.
20 Command Line Tools to Monitor Linux Performance
https://www.tecmint.com/command-line-tools-to-monitor-linux-performance/
by Ravi Saive | Published: April 27, 2014 | Last Updated: January 3, 2015
Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators | 4 Free Shell Scripting eBooks
It’s really very tough job for every System or Network administrator to monitor and debug Linux System Performance problems every day. After being a Linux Administrator for 5 years in IT industry, I came to know that how hard is to monitor and keep systems up and running. For this reason, we’ve compiled the list of Top 20frequently used command line monitoring tools that might be useful for every Linux/Unix System Administrator. These commands are available under all flavors of Linux and can be useful to monitor and find the actual causes of performance problem. This list of commands shown here are very enough for you to pick the one that is suitable for your monitoring scenario.
Linux Command Line Monitoring
1. Top – Linux Process Monitoring
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. The top command used to dipslay all the running and active real-time processes in ordered list and updates it regularly. 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 processess. The top command is much userful for system administrator to monitor and take correct action when required. Let’s see top command in action.
# top
Top Command Example
For more examples of Top command read : 12 TOP Command Examples in Linux
2. VmStat – Virtual Memory Statistics
Linux VmStat command used to display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more. By default vmstat command is not available under Linux systems you need to install a package called sysstat that includes a vmstat program. The common usage of command format is.
# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
r b swpd free inact active si so bi bo in cs us sy id wa st
1 0 0 810420 97380 70628 0 0 115 4 89 79 1 6 90 3 0
For more Vmstat examples read : 6 Vmstat Command Examples in Linux
3. Lsof – List Open Files
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. One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened. With this commmand you can easily identify which files are in use. The most common format for this command is.
# lsof
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
init 1 root cwd DIR 104,2 4096 2 /
init 1 root rtd DIR 104,2 4096 2 /
init 1 root txt REG 104,2 38652 17710339 /sbin/init
init 1 root mem REG 104,2 129900 196453 /lib/ld-2.5.so
init 1 root mem REG 104,2 1693812 196454 /lib/libc-2.5.so
init 1 root mem REG 104,2 20668 196479 /lib/libdl-2.5.so
init 1 root mem REG 104,2 245376 196419 /lib/libsepol.so.1
init 1 root mem REG 104,2 93508 196431 /lib/libselinux.so.1
init 1 root 10u FIFO 0,17 953 /dev/initctl
More lsof command usage and examples : 10 lsof Command Examples in Linux
4. Tcpdump – Network Packet Analyzer
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. It also provides a option to save captured packages in a file for later analysis. tcpdump is almost available in all major Linux distributions.
# tcpdump -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
22:08:59.617628 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 2532133365:2532133481(116) ack 3561562349 win 9648
22:09:07.653466 IP tecmint.com.ssh > 115.113.134.3.static-mumbai.vsnl.net.in.28472: P 116:232(116) ack 1 win 9648
22:08:59.617916 IP 115.113.134.3.static-mumbai.vsnl.net.in.28472 > tecmint.com.ssh: . ack 116 win 64347
For more tcpdump usage read : 12 Tcpdump Command Examples in Linux
5. Netstat – Network Statistics
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.
# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:realm-rusd *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 localhost.localdomain:ipp *:* LISTEN
tcp 0 0 localhost.localdomain:smtp *:* LISTEN
tcp 0 0 localhost.localdomain:smtp localhost.localdomain:42709 TIME_WAIT
tcp 0 0 localhost.localdomain:smtp localhost.localdomain:42710 TIME_WAIT
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:https *:* LISTEN
More Netstat examples : 20 Netstat Command Examples in Linux.
6. Htop – Linux Process Monitoring
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 and much more. Htop is a third party tool and doesn’t included in Linux systems, you need to install it using YUM package manager tool. For more information on installation read our article below.
# htop
Htop Command Example Screenshot
For Htop installation read : Install Htop (Linux Process Monitoring) in Linux
7. Iotop – Monitor Linux Disk I/O
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. This tool is much useful for finding the exact process and high used disk read/writes of the processes.
# iotop
Iotop Command Example Screenshot
For Ioptop installation and usage read : Install Iotop in Linux
8. Iostat – Input/Output Statistics
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
Linux 2.6.18-238.9.1.el5 (tecmint.com) 09/13/2012
avg-cpu: %user %nice %system %iowait %steal %idle
2.60 3.65 1.04 4.29 0.00 88.42
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
cciss/c0d0 17.79 545.80 256.52 855159769 401914750
cciss/c0d0p1 0.00 0.00 0.00 5459 3518
cciss/c0d0p2 16.45 533.97 245.18 836631746 384153384
cciss/c0d0p3 0.63 5.58 3.97 8737650 6215544
cciss/c0d0p4 0.00 0.00 0.00 8 0
cciss/c0d0p5 0.63 3.79 5.03 5936778 7882528
cciss/c0d0p6 0.08 2.46 2.34 3847771 3659776
For more Iostat usage and examples visit : 6 Iostat Command Examples in Linux
9. IPTraf – Real Time IP LAN Monitoring
IPTraf is an open source console-based real time network (IP LAN) monitoring utility for Linux. It collects a variety of information such as IP traffic monitor that passes over the network, including TCP flag information, ICMP details, TCP/UDP traffic breakdowns, TCP connection packet and byne counts. It also gathers information of general and detaled interface statistics of TCP, UDP, IP, ICMP, non-IP, IP checksum errors, interface activity etc.
IP Traffic Monitor
For more information and usage of IPTraf tool, please visit : IPTraf Network Monitoring Tool
10. Psacct or Acct – Monitor User Activity
psacct or acct tools are very useful for monitoring each users activity on the system. Both daemons runs in the background and keeps a close watch on the overall activity of each user on the system and also what resources are being consumed by them.
These tools are very useful for system administrators to track each users activity like what they are doing, what commands they issued, how much resources are used by them, how long they are active on the system etc.
For installation and example usage of commands read the article on Monitor User Activity with psacct or acct
11. Monit – Linux Process and Services Monitoring
Monit is a free open source and web based process supervision utility that automatically monitors and managers system processes, programs, files, directories, permissions, checksums and filesystems.
It monitors services like Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH and so on. The system status can be viewed from the command line or using it own web interface.
Monit Linux Process Monitoring
Read More : Linux Process Monitoring with Monit
12. NetHogs – Monitor Per Process Network Bandwidth
NetHogs is an open source nice small program (similar to Linux top command) that keeps a tab on each process network activity on your system. It also keeps a track of real time network traffic bandwidth used by each program or application.
NetHogs Linux Bandwidth Monitoring
Read More : Monitor Linux Network Bandwidth Using NetHogs
13. iftop – Network Bandwidth Monitoring
iftop is another terminal-based free open source system monitoring utility that displays a frequently updated list of network bandwidth utilization (source and destination hosts) that passing through the network interface on your system. iftop is considered for network usage, what ‘top‘ does for CPU usage. iftop is a ‘top‘ family tool that monitor a selected interface and displays a current bandwidth usage between two hosts.
iftop – Network Bandwidth Monitoring
Read More : iftop – Monitor Network Bandwidth Utilization
14. Monitorix – System and Network Monitoring
Monitorix is a free lightweight utility that is designed to run and monitor system and network resources as many as possible in Linux/Unix servers. It has a built in HTTP web server that regularly collects system and network information and display them in graphs. It Monitors system load average and usage, memory allocation, disk driver health, system services, network ports, mail statistics (Sendmail, Postfix, Dovecot, etc), MySQL statistics and many more. It designed to monitor overall system performance and helps in detecting failures, bottlenecks, abnormal activities etc.
Monitorix Monitoring
Read More : Monitorix a System and Network Monitoring Tool for Linux
15. Arpwatch – Ethernet Activity Monitor
Arpwatch is a kind of program that is designed to monitor Address Resolution (MAC and IP address changes) of Ethernet network traffic on a Linux network. It continuously keeps watch on Ethernet traffic and produces a log of IP and MAC address pair changes along with a timestamps on a network. It also has a feature to send an email alerts to administrator, when a pairing added or changes. It is very useful in detecting ARP spoofing on a network.
Read More : Arpwatch to Monitor Ethernet Activity
16. Suricata – Network Security Monitoring
Suricata is an high performance open source Network Security and Intrusion Detection and Prevention Monitoring System for Linux, FreeBSD and Windows.It was designed and owned by a non-profit foundation OISF(Open Information Security Foundation).
Read More : Suricata – A Network Intrusion Detection and Prevention System
17. VnStat PHP – Monitoring Network Bandwidth
VnStat PHP a web based frontend application for most popular networking tool called “vnstat“. VnStat PHPmonitors a network traffic usage in nicely graphical mode. It displays a total IN and OUT network traffic usage in hourly, daily, monthly and full summary report.
Read More : VnStat PHP – Monitoring Network Bandwidth
18. Nagios – Network/Server Monitoring
Nagios is an leading open source powerful monitoring system that enables network/system administrators to identify and resolve server related problems before they affect major business processes. With the Nagios system, administrators can able to monitor remote Linux, Windows, Switches, Routers and Printers on a single window. It shows critical warnings and indicates if something went wrong in your network/server which indirectly helps you to begin remediation processes before they occur.
Read More : Install Nagios Monitoring System to Monitor Remote Linux/Windows Hosts
19. Nmon: Monitor Linux Performance
Nmon (stands for Nigel’s performance Monitor) tool, which is used to monitor all Linux resources such as CPU, Memory, Disk Usage, Network, Top processes, NFS, Kernel and much more. This tool comes in two modes: Online Mode and Capture Mode.
The Online Mode, is used for real-time monitoring and Capture Mode, is used to store the output in CSV format for later processing.
Nmon Monitoring
Read More: Install Nmon (Performance Monitoring) Tool in Linux
20. Collectl: All-in-One Performance Monitoring Tool
Collectl is a yet another powerful and feature rich command line based utility, that can be used to gather information about Linux system resources such as CPU usage, memory, network, inodes, processes, nfs, tcp, sockets and much more.
Collectl Monitoring
Read More: Install Collectl (All-in-One Performance Monitoring) Tool in Linux
We would like to know what kind of monitoring programs you use to monitor performance of your Linux servers? If we’ve missed any important tool that you would like us to include in this list, please inform us via comments and please don’t forget to share it.
Read Also: 13 Linux Performance Monitoring Tools – Part 2.
/opt/tomcat8/tomcat8-lms/logs /opt/tomcat8/tomcat8-lx/logs /opt/tomcat8/tomcat8-upload/logs /appd ata/LPSR/logs /appdata/LPSR/logs /appdata/LPSR/logs /var/log/httpd24/se /var/log/httpd24/se
App Servers :
Please remove the logs in APP01 thru 06 and delete file names along with the folders are as below;
cd /opt/ls/tempwork/PA2/LOS/STMC/ViewDoc
rm -rf *.pdf
cd /opt/ls/tempwork/PA2/CP/STMC/ViewDoc
rm -rf *.pdf
cd /opt/tomcat8/tomcat8-los/logs
rm -rf *.log
rm -rf catalina.out
cd /opt/tomcat8/tomcat8-los/logs/los-log4j2
rm -rf *.log
cd /opt/tomcat8/tomcat8-portal/logs
rm -rf *.log
rm -rf catalina.out
cd /opt/tomcat8/tomcat8-portal/logs/portal-log4j2
rm -rf *.log
cd /opt/tomcat8/tomcat8-other/logs
rm -rf *.log
rm -rf catalina.out
cd /opt/tomcat8/tomcat8-other/logs/other-log4j2
rm -rf *.log
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Work engines
/opt/ls/logs/monitors/log4j