Useful Linux Commands

vi /etc/sysconfig/network  :: change the network name of a server

vi /etc/resdv.conf :: add in dns servers

rm -rf <dir> :: remove a directory, regardless if it has stuff in it

dmesg :: display hard drive / volume info

df -h :: get mount point info / usage

/usr/bin/system-config-network :: configure network IP/subnet

iostat -d -x :: get IO usage information

iostat %tm_act <mount point> <seconds> <intervals> (example iostat %tm_act 1 10) : show useful IO information, such as wait time, usage, idle time and so on.

ps -eo pcpu,pid,user,args | sort -k 1 -r -h | head -10 :: show me the 10 top resource hogs

mpstat -P ALL :: get cpu usage

fdisk -l :: volumes

du -ch :: display folder sizes from current location

ln <real file> shortcut :: create a hard link, ln -s makes a soft link

cp -p <file> <destination> :: copy a file, preserve permissions

rpm -ivh <package> :: install a package

rpm -qa :: show all installed packages, add --last for last installed packages

rpm -qi <package> :: get more info on a package

rpm -Uvh <package> :: upgrade a package

rpm -ev <package> :: uninstall a package

fuser -m /dev/mount :: find out who/what is using a particular drive

cat /proc/cpuinfo :: what cpu's are installed

lspci -v :: list pci devices

sar :: show me IO history

tar -cf <filename> <items to tar> :: create tar archive (does not compress)

gzip <filename.tar> :: create gzip -- use -1 for fastest or -9 for best.

mount -o remount / <enter> vi /etc/fstab :: if you boot linux without something it expects, you get a "superblock" error ...this allows you to fix that.

mount - l /location :: device busy?  try the -l

sudo grep --include=\*.xml -rnw '/' -e "<useSecurity>true</useSecurity>" :: find a file containing text in the system


Network Goodies