Saturday, September 8, 2012

A summary of useful Linux commands


i got this from a pdf document
squadron@powerup.com.au
Starting & Stopping
shutdown -h now        Shutdown the system now and do not reboot
halt                             Stop all processes - same as above
shutdown -r 5             Shutdown the system in 5 minutes and reboot
shutdown -r now         Shutdown the system now and reboot
reboot                        Stop all processes and then reboot - same as above
startx                          Start the X system
Accessing & mounting file systems
mount -t iso9660 /dev/cdrom/mnt/cdrom  : 
Mount the device cdrom and call it cdrom under the /mnt directory
mount -t msdos /dev/hdd /mnt/ddrive :  
Mount hard disk “d” as a msdos file system and call it ddrive under the /mntn directory
mount -t vfat /dev/hda1/mnt/cdrive :  
Mount hard disk “a” as a VFAT file system and call it cdrive under the /mnt directory
umount /mnt/cdrom :  
Unmount the cdrom

Finding files and text within files
find / -name fname
Starting with the root directory, look for the file called fname
find / -name ”*fname*”
Starting with the root directory, look for the file containing the string fname
locate missingfilename
Find a file called missingfilename using the locate command - this assumes you have already used the command updatedb (see next)
updatedb : 
Create or update the database of files on all file systems attached to the linux root directory
which missingfilename :
Show the subdirectory containing the executable file called missingfilename
grep textstringtofind /dir :
Starting with the directory called dir , look for and list all files containing textstringtofind