I would like to share with you some cool tools I use at work on Linux operating system, some of them I use occasionally others I use daily. Most of the definition are copied from the default Linux manual. If you need more details you can either open the man page in your terminal like this:
man <package name>
By checking on wikipedia or visiting the company’s website
iftop listens to network traffic on a named interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. Display real-time bandwidth usage on an interface by host. I use it very often to check who’s consuming our bandwidth on our router.
Display and update sorted information about processes. This is very helpful when you need to check which process is consuming more CPU and RAM.
The ps utility displays a header line, followed by lines containing information about all of your processes that have controlling terminals. Very often when I want to check if a process is rumming or not I filter the output of the ps command with the process name like this:
ps aux | grep "ProcessName"
The netstat command symbolically displays the contents of various network-related data structures. There are a number of output formats, depending on the options for the information presented. Usually I use this tool to see my server is listening on which port number and if there is any connection established like this:
Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts.
This will scan the entire network of the local network and let me know which are pingable and which ports are open. If you haveve just plugged in a new hardware (e.g. Raspberry Pi), but don’t know what IP address it grabbed via DHCP, Nmap is priceless.
Display amount of free and used memory in the system. use it with “-m” to get the results in MB
Display who is logged in and what they are doing.
mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool. You can use the “–report” option to generate statistics about network quality.
mtr --report 188.8.131.52
The arping utility sends ARP and/or ICMP requests to the specified host and displays the replies. The host may be specified by its hostname, its IP address, or its MAC address. Very useful to identify the IP from a given MAC address or vice versa.
Tcpdump prints out a description of the contents of packets on a network interface that match the boolean expression. For exemple you can run the following command to intercept all icmp traffic on all interfaces on the machine:
tcpdump icmp -n -i any
The sar command is used to sample and report various cumulative statistic counters maintained by the operating system.
Lsof revision lists on its standard output file information about files opened by processes.
General system information
# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/zoneinfo
# cat /proc/mounts
Vagrant is free and open-source software for creating and configuring virtual development environments. It can be considered a wrapper around virtualization software such as VirtualBox and configuration management software such as Ansible, Chef, Salt and Puppet. Create and configure lightweight, reproducible, and portable development environments with Vagrant!
Ansible is the simplest way to automate apps and IT infrastructure. Application Deployment + Configuration Management + Continuous Delivery. You can checkout some of my roles I’ve created with ansible here or you can check it out on my github.
psacct or acct
psacct or acct both are open source application for monitoring users activities on the system. These applications runs in the background and keeps track of each users activity on your system as well as what resources are being consumed. Both psacct and acct are similar tools whereas psacct is available for RPM based systems and acct is available for DEB based systems. We have a development server where all developers connects to, with this tool I keep an eye on the server 😉 The psacct or acct package provides several features for monitoring process activities.
- ac command prints the statistics of user logins/logouts (connect time) in hours.
- lastcomm command prints the information of previously executed commands of user.
- accton commands is used to turn on/off process for accounting.
- sa command summarizes information of previously executed commands.
- last and lastb commands show listing of last logged in users.
Run commands in the background
- Start a process directly in background
sleep 100 &
- Start a process and put it in background
sleep 100 ; < CTRL > Z ; bg
- Move a process from background to foreground
sleep 100 &; sleep 100; < CTRL > Z ; bg ; jobs ; fg 2
- Start a process, log off and have the process running
nohup YourVeryLongTask.sh &
- Log off from a terminal keeping active a process we started without nohup
YourVeryLongTask.sh ; < ctrl > Z; bg; disown -h %1
Most Linux systems have several virtual consoles running in the background. Switch between them by pressing Ctrl-Alt and hitting a key between F1 and F6. Ctrl-Alt-F7 will usually take you back to the graphical X server. Did I miss something? Please add your favorite system tool in the comments. Photo credit: Profound Whatever via photopin cc