Softwares |
Main /
LinuxCommandsMain.LinuxCommands HistoryShow minor edits - Show changes to output Added lines 1-5:
(:Google1:) (:Googlemm:) ---- Added lines 123-126:
(:Google1:) (:Googlemm:) ---- Added lines 260-262:
(:Google1:) (:Googlemm:) ---- Changed lines 88-89 from:
[root@ibm html]# sar to:
[root@ibm html]# sar Added line 163:
Changed lines 218-219 from:
to:
%blue%Run any command in the background command& (example - knotes&) Changed lines 13-14 from:
to:
#hostname reports the hostname of the machine Added line 17:
Added line 29:
Added line 34:
Added line 45:
Added line 49:
Changed lines 118-119 from:
#gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - burn cdrom image (use dev=ATAPI -scanbus to confirm dev) to:
#gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - burn cdrom image (use dev=ATAPI -scanbus to confirm dev) Changed lines 121-122 from:
#cdrecord -v dev=/dev/cdrom -audio *.wav make audio CD from all wavs in current dir (see also cdrdao) to:
#cdrecord -v dev=/dev/cdrom -audio *.wav make audio CD from all wavs in current dir (see also cdrdao) Added line 173:
Added line 176:
Added line 240:
Changed lines 2-3 from:
to:
#apropos fonts Changed lines 6-38 from:
#init 6 reboot #hostname -i Display the systems IP address #hostname reports the hostname of the machine #cat document /dev/lp0 #ls -alist hidden files #ls- ld #who >> A #less /var/log/messages #cp -rf [sourcedirectory] [destinationdir] #rm -rf directoryname #cd .. goes back to the immediate parent directory #cd ~takes you back to your home directory #cd ~[useranme] this can take your to the home dir of #mv [oldfilelname] [newfilename] #df -hs #df /dev/hda1 #env shows the current sets of environment variable # apropos xine # to:
#init 0 Shutdown the system #init 6 reboot the system #hwclock --set --date="9/22/96 16:45:05" changing the system date and time. #hostname -i Display the systems IP address #hostname reports the hostname of the machine #cat document /dev/lp0 the content of document is printed #ls -a list hidden files #ls- ld /varlist the dir /var with it's attributes #who >> A the output of the who command is appended to file A #less /var/log/messages #tail -f /var/log/messages -output appended data as the file grows #cp -rf [sourcedirectory] [destinationdir] #rm -rf directoryname deletes the directory recursiveky and interactively #cd .. goes back to the immediate parent directory #cd ~takes you back to your home directory #cd ~[useranme] this can take your to the home dir of the user #mv [oldfilelname] [newfilename] #df -hs to vew the disk usage in megabytes #df /dev/hda1 #env shows the current sets of environment variable # apropos xine xine (1) - a free video player # which unzip show full path name of command /usr/bin/unzip Changed lines 42-44 from:
#renice #renice to:
#nice command run a low priority command #renice #renice -n 19 12345 # 12345 represents the PID of your process Changed lines 46-47 from:
#renice 19 -p process_id to:
#renice 19 -p process_id Changed lines 54-59 from:
#ps -ef | more #ps #ps to:
#ps -ef #ps -ef | more #ps -ef | grep username #ps -ef | grep username | more Changed lines 62-66 from:
#ps -efl |more to:
#ps -efl #ps -efl |more #ps -efl |grep username #ps -efl |grep username|more Changed lines 69-70 from:
# vmstat 2 5 (where 2 is delay and 5 is count) to:
# vmstat 2 5 (where 2 is delay and 5 is count) Changed lines 73-74 from:
# mpstat 1 4 to:
# mpstat 1 4 Changed line 77 from:
# iostat -dk 1 4 to:
# iostat -dk 1 4 Changed lines 87-91 from:
#gpg file.gpg decrypt file to:
#gpg -c file encrypt file #gpg file.gpg decrypt file Changed lines 94-105 from:
#locate / #uname -r gives out the current kernel version #lsmod list currently loaded modules #modeprobe ide #lspci list the to:
#find / -name *.pl -print finds the file with .pl from the filesystem root #locate /root #slocate httpd.conf the /var/lib/slocate/slocate.db should be updated for this to work. #uname -r gives out the current kernel version #lsmod list currently loaded modules #modeprobe ide-scsi will load the module for SCSI emulation #lspci list the currently detected pci cards #dd if=/dev/cdrom of=/root/cdrom.dd will copy the content to a file. Changed lines 106-112 from:
#cdrecord -v speed=8 dev=0,0,0 /root/cdrom.dd #gzip < / #mount -o loop cdrom.iso /mnt/dir mount the cdrom image at /mnt/dir (read only) to:
#cdrecord -scanbus shows the emulated cd writer #cdrecord -v speed=8 dev=0,0,0 /root/cdrom.dd duplicates the file #gzip < /dev/cdrom > cdrom.iso.gz save copy of data cdrom #mkisofs -r dir | gzip > cdrom.iso.gz create cdrom image from contents of dir #mount -o loop cdrom.iso /mnt/dir mount the cdrom image at /mnt/dir (read only) Changed lines 114-116 from:
#cdrecord -v dev=/dev/cdrom -audio *.wav make audio CD from all wavs in current dir (see also cdrdao) to:
#cdparanoia -B rip audio tracks from CD to wav files in current dir #cdrecord -v dev=/dev/cdrom -audio *.wav make audio CD from all wavs in current dir (see also cdrdao) Changed line 119 from:
#mkisofs -J -R /document.iso /document this makes the iso image to:
#mkisofs -J -R /document.iso /document this makes the iso image Changed lines 125-126 from:
#mkdir -p /1/2/3/4/ to:
#mkdir -p /1/2/3/4/ Changed lines 129-130 from:
#alias mkdir=mk -to set alias for mkdir command to:
#alias mkdir=mk -to set alias for mkdir command Changed lines 133-134 from:
to:
# cat /etc/passwd |sort |less Changed lines 137-141 from:
grep.1.gz is redirected to the gunzip command to be unzipped to:
#gunzip < /usr/share/man/man1/grep.1.gz |nroff -c -man |less grep.1.gz is redirected to the gunzip command to be unzipped Changed lines 144-147 from:
troff to:
#date; troff -me document |lpr; date troff - the troff processor of the groff text formatting system. Changed lines 151-160 from:
#grep ^ #grep effect$ /etc/services - {to get the strings ending with #grep #grep #grep -i Ftp /etc/services #grep -l "192.168" * { only displays the file that contains the character } #grep #grep to:
#grep ftp /etc/services #grep ^ftp /etc/services -{to get the strings begining with ftp} #grep effect$ /etc/services - {to get the strings ending with effect} #grep -v ^# /etc/services { dispaly excluding the lines starting with # } #grep -i {case insensitive} #grep -i Ftp /etc/services #grep -l "192.168" * { only displays the file that contains the character } #grep -l 192\.168 * #grep -l '192.168' * Changed lines 164-167 from:
#cut -d : -f 7 /etc/passwd to:
#cut -d : -f 7 /etc/passwd | head -2 #cut -d : -f 7 /etc/passwd | uniq #cut -d : -f 7 /etc/passwd |sort| uniq #cut -d : -f 7 /etc/passwd Changed line 173 from:
#sed -i s/nologin/login/g /etc/passwd to:
#sed -i s/nologin/login/g /etc/passwd Changed line 177 from:
#sed -ibackup s/nolgin/login/g /etc/passwd to:
#sed -ibackup s/nolgin/login/g /etc/passwd Changed lines 208-209 from:
%blue%command & to:
%blue%command & Added line 215:
Changed lines 230-231 from:
to:
%blue%Using ipcalc command [root@ibm ~]# ipcalc -m 192.168.0.11 NETMASK=255.255.255.0 [root@ibm ~]# ipcalc -b 192.168.0.11/24 BROADCAST=192.168.0.255 [root@ibm ~]# ipcalc -n 192.168.0.11/24 NETWORK=192.168.0.0 [root@ibm ~]# ipcalc -n 192.168.0.11/24 Changed lines 209-212 from:
Run any command in the background (the symbol "&" means "run the preceding command in the background"). to:
Run any command in the background (the symbol "&" means "run the preceding command in the background"). %blue%Compress a file with bzip2/tar bzip2 -z -9 filename Decompressing the file is simple using the command bunzip2 -d <filename>. For example: bunzip2 -d toobig.bz2 -d --decompress Force decompression. bzip2, bunzip2 and bzcat are really the same program, and the decision about what actions to take is done on the basis of which name is used. This flag overrides that mechanism, and forces bzip2 to decompress. -z --compress The complement to -d: forces compression, regardless of the invocation name. Changed lines 207-210 from:
to:
%blue%command & Run any command in the background (the symbol "&" means "run the preceding command in the background"). Changed lines 206-214 from:
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 11938986 0 0 0 12384152 0 0 0 BMRU eth0:1 1500 0 0 0 0 0 0 0 0 0 BMRU lo 16436 0 14456 0 0 0 14456 0 0 0 LRU to:
Changed lines 197-198 from:
to:
%blue%netstat netstat -a Active Internet connections (servers and established) netstat -an [-n flag to turn off DNS lookups] Netstat can help diagnose NIC problems. Use the -i flag netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 11938986 0 0 0 12384152 0 0 0 BMRU eth0:1 1500 0 0 0 0 0 0 0 0 0 BMRU lo 16436 0 14456 0 0 0 14456 0 0 0 LRU Changed lines 193-195 from:
to:
%blue%Setting the system clock To set the system clock under Linux, use the date command. As an example, to set the current time and date to July 31, 11:16pm, type ``date 07312316'' (note that the time is given in 24 hour notation). Changed lines 177-178 from:
This command takes the backup copy of the file /etc/passwd before editing. to:
This command takes the backup copy of the file /etc/passwd before editing. %blue%Using the tmpwatch Command tmpwatch -uav 1 /tmp tmpwatch - removes files which been accessed for a period of time. Tmpwatch recursively removes files which been accessed for a given number of hours. Normally, used to clean up directories which are used for temporary holding space such as /tmp. -v, --verbose -u, --atime Make the decision about deleting a file based on the atime (access time). This is the default. -a, --all Remove all file types, not just regular files and directories. Changed lines 79-87 from:
Linux 2.6.9-1.667 (ibm) 12/27/2011 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 4.90 36.38 30.45 11937900 9994199 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 0.00 0.00 0.00 0 0 to:
Changed lines 83-90 from:
12:00:01 AM CPU %user %nice %system %iowait %idle 12:10:01 AM all 99.88 0.00 0.12 0.00 0.00 12:20:01 AM all 99.87 0.00 0.13 0.00 0.00 12:30:01 AM all 99.87 0.00 0.13 0.00 0.00 to:
Added lines 1-3:
%blue%Finding out which man page has the information am looking for #apropos fonts Deleted lines 8-11:
%blue%Finding out which man page has the information am looking for #apropos fonts Changed lines 36-41 from:
# apropos xine # which unzip /usr/bin/unzip to:
# apropos xine xine (1) - a free video player # which unzip show full path name of command /usr/bin/unzip Added lines 1-196:
%blue%Basic Commands #init 0 Shutdown the system #init 6 reboot the system %blue%Finding out which man page has the information am looking for #apropos fonts #hwclock --set --date="9/22/96 16:45:05"changing the system date and time. #hostname -i Display the systems IP address #hostname reports the hostname of the machine #cat document /dev/lp0 the content of document is printed #ls -alist hidden files #ls- ld /varlist the dir /var with it's attributes #who >> A the output of the who command is appended to file A #less /var/log/messages #tail -f /var/log/messages -output appended data as the file grows #cp -rf [sourcedirectory] [destinationdir] #rm -rf directoryname deletes the directory recursiveky and interactively #cd .. goes back to the immediate parent directory #cd ~takes you back to your home directory #cd ~[useranme] this can take your to the home dir of the user #mv [oldfilelname] [newfilename] #df -hs to vew the disk usage in megabytes #df /dev/hda1 #env shows the current sets of environment variable # apropos xine xine (1) - a free video player # which unzip show full path name of command /usr/bin/unzip %blue%nice and renice commands nice - run a command at non-default priority #nice command run a low priority command #renice #renice -n 19 12345 # 12345 represents the PID of your process This command will set the nice value of the process with the process ID of process_id to 19: #renice 19 -p process_id 19 is the level you should use for a long running process. %blue%ps command Generate a full listing of all processes currently running on your machine: #ps -ef #ps -ef | more #ps -ef | grep username #ps -ef | grep username | more %blue%Examining process #ps -efl #ps -efl |more #ps -efl |grep username #ps -efl |grep username|more %blue%Displays information about memory, cpu and disk # vmstat 2 5 (where 2 is delay and 5 is count) %blue%Displays statistics about cpu utilization # mpstat 1 4 %blue%Displays statistics about the disk system # iostat -dk 1 4 -d - Gives the device utilization report. -k - Display statistics in kilobytes per second. [root@ibm html]# iostat -dk 1 4 Linux 2.6.9-1.667 (ibm) 12/27/2011 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 4.90 36.38 30.45 11937900 9994199 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn sda 0.00 0.00 0.00 0 0 %blue%Displays overall system performance. [root@ibm html]# sar Linux 2.6.9-1.667 (ibm) 12/27/2011 12:00:01 AM CPU %user %nice %system %iowait %idle 12:10:01 AM all 99.88 0.00 0.12 0.00 0.00 12:20:01 AM all 99.87 0.00 0.13 0.00 0.00 12:30:01 AM all 99.87 0.00 0.13 0.00 0.00 %blue%GPG encrypt a file #gpg -c file encrypt file #gpg file.gpg decrypt file %blue%Using find command Commands #find / -name *.pl -print finds the file with .pl from the filesystem root #locate /root #slocate httpd.conf the /var/lib/slocate/slocate.db should be updated for this to work. #uname -r gives out the current kernel version #lsmod list currently loaded modules #modeprobe ide-scsi will load the module for SCSI emulation #lspci list the currently detected pci cards #dd if=/dev/cdrom of=/root/cdrom.dd will copy the content to a file. %blue%Burning Cd using cdrecord command #cdrecord -scanbus shows the emulated cd writer #cdrecord -v speed=8 dev=0,0,0 /root/cdrom.dd duplicates the file #gzip < /dev/cdrom > cdrom.iso.gz save copy of data cdrom #mkisofs -r dir | gzip > cdrom.iso.gz create cdrom image from contents of dir #mount -o loop cdrom.iso /mnt/dir mount the cdrom image at /mnt/dir (read only) #gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - burn cdrom image (use dev=ATAPI -scanbus to confirm dev) #cdparanoia -B rip audio tracks from CD to wav files in current dir #cdrecord -v dev=/dev/cdrom -audio *.wav make audio CD from all wavs in current dir (see also cdrdao) %blue%Creating iso files #mkisofs -J -R /document.iso /document this makes the iso image of the directory document to document.iso, we can use the cdrecord command to burn it. %blue%How to create directory with parenting #mkdir -p /1/2/3/4/ %blue%To create aliase for a commnad #alias mkdir=mk -to set alias for mkdir command %blue%Piping Commands in Linux # cat /etc/passwd |sort |less Here the sort command sorts the passwd file automatically. #gunzip < /usr/share/man/man1/grep.1.gz |nroff -c -man |less grep.1.gz is redirected to the gunzip command to be unzipped %blue%Sequential Commands #date; troff -me document |lpr; date troff - the troff processor of the groff text formatting system. %blue%Grep Commands Grep - Global Regular Expression Parser #grep ftp /etc/services #grep ^ftp /etc/services -{to get the strings begining with ftp} #grep effect$ /etc/services - {to get the strings ending with effect} #grep -v ^# /etc/services { dispaly excluding the lines starting with # } #grep -i {case insensitive} #grep -i Ftp /etc/services #grep -l "192.168" * { only displays the file that contains the character } #grep -l 192\.168 * #grep -l '192.168' * %blue%Using the Cut #cut -d : -f 7 /etc/passwd | head -2 #cut -d : -f 7 /etc/passwd | uniq #cut -d : -f 7 /etc/passwd |sort| uniq #cut -d : -f 7 /etc/passwd The commands will allow to print out the seventh field in the passwd file. %blue%Using the Sed Command Sed - Sed is a Stream Editor #sed -i s/nologin/login/g /etc/passwd This command replaces the word nologin in the file /etc/passwd globally with login. #sed -ibackup s/nolgin/login/g /etc/passwd This command takes the backup copy of the file /etc/passwd before editing. |