Bash Index : I - The 'I' Bash commands : description, flags and examples


Usage :

Set / display a process I/O nice value.

Flags :

Flag Usage
-c classValue Apply the specified class value to the process. Class values :
  • 0 : none
  • 1 : real time
  • 2 : best-effort. This is the effective scheduling class for any process that has not asked for a specific I/O priority. This class takes a priority argument
  • 3 : idle. Get disk time when no other program has asked for disk I/O for a defined grace period. Impact on normal system activity should be zero.
-n priority Priority of job within its class. Ranges from 0 (highest) to 7 (lowest).
-p PID Apply to the specified process ID

root permissions are required to :

Example :

Set the ionice value of the process having the PID 9799

ionice -c 3 -p 9799

Display the ionice value of the process having the PID 9799

ionice -p 9799

Set the actual shell to idle priority :

This is useful when you don't want local shell actions to interfere with existing processes : ionice -c3 -p$$


Usage :

iftop is not really a Bash command, it's an additional utility designed to monitor network usage.
It can easily be installed on "Debianoids" with apt-get install iftop.
Running iftop requires root privileges.

Flags :

Flag Usage
-i interface Listen on interface

Example :

Monitor usage of interface eth0 :

iftop -i eth0


Flags :

interactive-mode keys :
Flag Usage
? show help

Example :

Start an innotop session :

innotop -h host -u login -ppassword


Usage :

Report CPU and I/O stats :
iostat options interval/count
This comes from the sysstat Debian package.

Flags :

Flag Usage
-c display the CPU usage report
-d display the device usage report
-h make the NFS report human-readable
-m display statistics in megabytes per second instead of blocks or kilobytes per second
-n display the network filesystem (NFS) report
-x display extended statistics

Example :

NFS report updated every 2 seconds :

iostat -nhm 2


Usage :

print real and effective user and group IDs
If no username is provided, id returns information about the user invoking it.
Special uid's
  • root has the uid 0
  • nobody has the largest possible uid (as the opposite of the superuser) : 32767

Flags :

Flag Usage
-u --user print only the effective user ID
-n --name print a name instead of a number
If you need to get the current user name :
  • id -un will do the trick
  • $USER is even simpler


Usage :

Show / manipulate routing, devices, policy routing and tunnels.
Synopsis :

ip options object command

Objects :

Example :

Get interface status (name + up/down status + MTU + MAC address) :
  • ip link show
  • ip link show eth0
Turn interface up/down :
  • Was : ifconfig lo up|down
  • Now : ip link set lo up|down

ip addr :

Get interface status (as above + IP address) :
  • ip addr or ip a
  • ip addr show eth0 or ip a s eth0
Create a virtual interface :
  • Was : deviceName='eth0:test'; ipAddress=''; ifconfig $deviceName $ipAddress up; ifconfig $deviceName; ping -c 3 $ipAddress; ifconfig $deviceName down; ifconfig
  • Now : deviceName='eth0:test'; ipAddress=''; maskLength=24; ip addr add $ipAddress/$maskLength dev $deviceName; ip a s $deviceName; ping -c 3 $ipAddress; ip addr del $ipAddress/$maskLength dev $deviceName; ip a

ip route :

find the network gateway (i.e. router)'s IP address :
ip r | grep default
default via dev eth0 proto static metric 100
find the route that will be used to reach the specified IP address :
  • ip route get
  • short version : ip r g via dev eth0 src
delete a route :
ip route del routeSpecification
The man page says routeSpecification has the same format than for ip route add (see example).

ip rule (source) :

This is the command to manipulate the RPDB.


Usage :

top-like I/O monitor, coming from iotop.

Flags :

Flag Usage
-a --accumulated Show accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started.
-d seconds --delay=seconds Set the delay between iterations in seconds (1 second by default). Accepts non-integer values such as 1.1 seconds.
-o --only Show only processes doing I/O instead of showing them all.
Can be toggled dynamically by pressing o.
-P --processes Show only processes (processes + threads by default)
-p PIDs --pid=PIDs Monitor PIDs (all by default)
-u users --user=users Monitor processes from the users list (all by default)