Saturday, April 4, 2009

ECHO command

echo $SHELL = prints the default shell name
echo $OSTYPE = prints the operating system name
echo 'text' = prints what is held in the quotes
echo $HOME = prints home directory
echo $USER = who is currently using the system
echo $HISTFILE = location of history file
echo $HISTFILESIZE = history's set size
echo $HISTSIZE = history's set size
echo “test” | mail -v -s test xyz@abc.com = sending e-mail from a terminal

MAN command

man -f php = info about php modules
man -k php = info about php modules
man php = php manual pages
man man = info about manual pages and their format
man 3 php = shows entries for php in 3rd section of the manual
man php | grep word = searches for a particular word in php manual
man hier = info about directories

LSPCI command

lspci = info about pci devices/ports
lspci | grep VGA = graphics card info
lspci | grep audio = audio card info
lspci | grep -i modem = modem info
lspci | grep -i usb = usb ports info
lspci | grep -i ethernet = ethernet card info

LS command

ls /var/www/html/*.html = lists all html files
ls .??* = lists all directory names that start with a dot .
ls /etc/rc.d = prints all directories for all available run levels
ls /etc/rc.d/init.d = list of system services' scripts
ls -l = lists files and folders in the current directory
ls -la = lists files and folders in the current directory with a dot
ls li = files with their inodes
ls -lt = files recently modified
ls -lu = lists files by their accss time
ls -ln = user names and groups numerically displayed
ls -lh = human readable file sizes
ls -lR = displays all the files and their folders
ls -F = lists files by type
ls -c = lists files columnwise
ls –color =always = shows filenames in colors

ls -l /var/lib/rpm = rpm database
ls = lists contents of a directory
ls . = lists contents of a directory
ls .. = lists contents of a directory
ls / = lists all system directories
ls = lists directories in current directory
ls /var = lists all subdirectories under the /var directory
ls /proc | wc -l = number of subdirectories in /proc directory
ls -ltr =
ls -l filename.ext = checks permissions for a file
ls -l /etc = permission status of all subdirectories
ls -a = shows hidden . Dot directories. A kind of special configuration files not be messed with

LOCATE command

locate xyz = locates file xyz case-sensitive
locate -i xyz = locates file xyz not case-sensitive
locate -r /ls$ = locates files ending in /ls
locate -r james*bond = locate files with james and bond in their names
locate -r ^ boot/grub/me = locate files beginning with boot/grub/me
locate *.jpg > Desktop/myjpgs.txt = stores results of search in a file named myjpgs.txt

HISTORY command

history | wc -l = total history commands
history | grep rpm = search through history for rpm commands
history = list of all commands used so far

DMIDECODE command

dmidecode = BIOS info
dmidecode | head -n10 = first 10 lines of BIOS info
dmidecode –-type baseboard = baseboard info
dmidecode –-type cache = cache info
dmidecode –-type chassis = chassis info
dmidecode –-type connector = connector info
dmidecode –-type memory = memory info
dmidecode –type processor = processor info
dmidecode –-type slot = slot info
dmidecode –-type system = system info
dmidecode –-type wrongtype = gives right words/types

CAT command

cat /var/log/yum.log
cat /var/log/yum.log | grep mysql = mysql install and update dates
cat /proc/meminfo = prints memory info
cat /proc/cpuinfo = prints cpu info
cat /var/log/manylogs/mylogonly.log = prints output of a file
cat /selinux/enforce = current status of selinux
cat /etc/shells = lists all installed shells on the os
cat /etc/inittab = info about run levels
cat filename | sort = sorting output in alphabetical order
cat /etc/x11/xorg.conf = monitor info
cat filename1 filename2>filename3 = merges the files
cat /etc/fstab = list of all devices
cat /etc/filesystems = of file systems
cat /var/log/messages | grep -F ntpd =