Linux Commands

Everyday Linux Administration Commands

Linux: Redirection and Pipe Commands




Command Description
cmd > file Send output from cmd to file
cmd >> file Append output from cmd to file
> file Null file - make file Zero bytes in size
cmd > /dev/null Discard all output from command
cmd 2> file Send stderr output of command to file
cmd 1>&2 Send stdout to same place as stderr
cmd 2>&1 Send stderr to same place as stdout
cmd1 | cmd2 Stdout of cmd1 to cmd2
cmd &> file All output from cmd goes to file


Linux: Process management commands


Command Description
top Overview of processes, memory and System Load along with PIDs
free Display amount of used and free memory in system
ps Display current processes
ps aux Display every process on system
ps axjf Display all process in a tree like format
ps -fu userid Display processes owned by userid
pstree Display a tree of processes
pgrep process_name Lookup and display process by name
pgrep -u userid Displays PID information for specified user
pidstat Display statistics on individual tasks
pkill pattern Kill processes with name matching pattern
kill PID Kills specified PID
killall name Kills all processes with the name name

Linux: Managing Disk Quotas


Command Description
quotacheck -acug Create quota files for filesystem specified in mount table
quotaon -p /filesystem Display current status of quotas on filesystem.
quotaon -uagv Turns quotas on for users and groups
quotaoff -ugv Turns quotas off
edquota -u userid Edit quota file for userid
edquota -g group Edit quota file for group
edquota -t Defines grace period
quota Display disk usage and limits
repquota -ug /filesystem Create quota report for filesystem filesystem

Linux: Filesystems and Disk Commands


Command Description
fdisk -l Display Current disk Configuration
fdisk /dev/sdx Open interactive dialogues for partition manipulation on disk /dev/sdx
mount Display mounted filesystems and their type
mount -a Mount entries found in mount table /etc/fstab
umount filesystem or device Unmount filesystem or device
mount /dev/sdx /dir Mount filesystem /dev/sdx on mount point /dir
mkfs Builds a Linux Filesystem
mkfs.ext2 /dev/sdx Make filesystem of type ext2 on device /dev/sdx
mkfs.ext3 /dev/sdx Make filesystem of type ext3 on device /dev/sdx
mkfs.ext4 /dev/sdx Make filesystem of type ext4 on device /dev/sdx

Linux:Package management Commands


Command Description
dpkg -l package Displays package information for specified package
dpkg -i package Install package package
dpkg -r package Remove package package
dpkg --get-selections Display only installed packages
rpm -qa package Check for installed package package
rpm -Uhv package Upgrade or install package
rpm -ev package Remove package
apt-get install package Install package
apt-get remove package Remove package
apt-get update Update package files
zypper se package Search for installed package
zypper in package Install package
zypper remove package Remove package
yum list installed Display packages installed
yum list available Display packages that can be installed from your repositories
yum install package Installs package
yum remove package Removes package