Linux quick commands

by GJSenthil 2007-09-14 17:49:25

Here goes quick linux command tips for newbie and intermediate users...

As root

To have a stop watch scenario from command line terminal --> time cat
To measure the time of executing any executable command --> time firefox
To CD to a user's home directory --> cd ~userhome
To list out all your iptables rules --> iptables -L
To save your currently loaded firewall iptable rules --> iptables-save
To download a file using wget --> wget -c ""
To limit your download rate with wget --> wget --limit-rate=30k ""
To download multiple files in one shot --> wget -c "[1-9].iso
To find windows machine with shared folders --> findsmb
To look for windows netbios name --> nmblookup -A windows-ip-address
To browse for computers like network neighborhood does --> smbtree
To list folder shared by a particular windows machine --> smbclient -L windows-machine
To list out all harddisk partition --> cat /proc/partitions --> fdisk -I
To list out all mounted and labeled harddisk partition --> mount -l
To show host reboot history --> reboot history
To get CPU info --> cat/proc/cpuinfo
To show all interrupts --> cat/proc/interrupts
To show last successful login users --> lastlog
To setup a shell with yum --> yum shell
To use yum locally --> yum localinstall packagename
To find file with 750 file permission --> find / -type f -perm 750
To find all files not owned by any user --> find / -nouser
To find all files owned by a user --> find / home -user vertito
To find files by group name --> find / home -group vertito
To change timestamp of a file --> touch -c -t 0707280337 testfile.txt (YYMMDDhhmm)
To make an ISO image from contents of a directory --> mkisofs -V label-name -r directory-name > iso-image.iso
To clear or erase all data from a mounted DVDRW / CDRW disk --> cdrecord -v dev=/dev/cdrom blank=fast
To add an ext3 journal to a filesystem --> tune2fs -j /dev/sdb1
To create ext2/ext3 filesystem with bad block checking --> mkfs.ext3 -c /dev/sdb1 or mkfs.ext2 -c /dev/sdb1
To combine and sort multiple raw files in one shot --> sort file1 file2 | uniq > newfile
To get the maximum number of threads of your host --> cat /proc/sys/kernel/threads-max
To backup harddisk to another host via ssh --> dd bs=1M if=/dev/sda | gzip | ssh username@remote-ip-address 'dd of=hda.gz'
To run a command as another user --> runuser another-user script-name-or-program

Tagged in:


You must LOGIN to add comments