Vous êtes sur la page 1sur 20

Linux Command Line in English - LinuxGuide.

it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Server not found


Firefox can't find the server at www.linuxguide.it.
Check the address for typing errors such as ww.example.com instead of www.example.com

Our sponsors | Become sponsor - without any sponsor our work would be impossible, thank you

Linux Command Line in English


PLEASE, help us to share this document through TWITTER | FACEBOOK License EDIT/TRANSLATE Credits ToDO (Help US)

| System information | Shutdown, Restart and Logout of a system | Files and Directory | File search | Mounting a Filesystem | Disk Space | Users and Groups | Permits on Files | Special Attributes on files | Archives and compressed files | RPM Packages ( Fedora, Red Hat and like) | YUM packages tool (Fedora, RedHat and alike) | DEB packages (Debian, Ubuntu and like) | APT packages tool (Debian, Ubuntu and alike) | View file content | Text Manipulation | Character set and Format file conversion | Filesystem Analysis | Format a Filesystem | Filesystem SWAP | Backup | CDROM | Networking (LAN / WiFi) | Microsoft Windows networks (samba) | IPTABLES (firewall) | Monitoring and debugging | Others useful commands | Pacman packages tool (Arch, Frugalware and alike) |

System information
Command # arch # cal 2007 # cat /proc/cpuinfo # cat /proc/interrupts # cat /proc/meminfo # cat /proc/swaps # cat /proc/version # cat /proc/net/dev # cat /proc/mounts # clock -w # date Description show architecture of machine(1) [man] show the timetable of 2007 [man] show information CPU info [man] show interrupts [man] verify memory use [man] show file(s) swap [man] show version of the kernel [man] show network adpters and statistics [man] show mounted file system(s) [man] save date changes on BIOS [man] show system date [man]

1 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# date 041217002007.00 # dmidecode -q # hdparm -i /dev/hda # hdparm -tT /dev/sda # lspci -tv # lsusb -tv # uname -m # uname -r TOP

set date and time MonthDayhoursMinutesYear.Seconds [man] show hardware system components - (SMBIOS / DMI) [man] displays the characteristics of a hard-disk [man] perform test reading on a hard-disk [man] display PCI devices [man] show USB devices [man] show architecture of machine(2) [man] show used kernel version [man]

Linux Command Line written by LinuxGuide.it (Credits)

Shutdown, Restart and Logout of a system


Command # init 0 # logout # reboot # shutdown -h now # shutdown -h 16:30 & # shutdown -c # shutdown -r now # telinit 0 TOP Description shutdown system(2) [man] leaving session [man] reboot(2) [man] shutdown system(1) [man] planned shutdown of the system at 16:30 [man] cancel a planned shutdown of the system [man] reboot(1) [man] shutdown system(3) [man] Linux Command Line written by LinuxGuide.it (Credits)

Files and Directory


Command # cd /home # cd .. # cd ../.. # cd # cd ~user1 # cd # cp file1 file2 Description enter to directory '/ home' [man] go back one level [man] go back two levels [man] go to home directory [man] go to home directory [man] go to previous directory [man] copying a file [man]

2 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# cp dir/* . # cp -a /tmp/dir1 . # cp -a dir1 dir2 # cp file file1 # iconv -l # iconv -f fromEncoding -t toEncoding inputFile > outputFile # find . -maxdepth 1 -name *.jpg -print -exec convert # ln -s file1 lnk1 # ln file1 lnk1 # ls # ls -F # ls -l # ls -a # ls *[0-9]* # lstree # mkdir dir1 # mkdir dir1 dir2 # mkdir -p /tmp/dir1/dir2 # mv dir1 new_dir # pwd # rm -f file1 # rm -rf dir1 # rm -rf dir1 dir2 # rmdir dir1 # touch -t 0712250000 file1 # tree

copy all files of a directory within the current work directory [man] copy a directory within the current work directory [man] copy a directory [man] outputs the mime type of the file as text [man] lists known encodings [man] converting the coding of characters from one format to another [man] batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick) [man] create a symbolic link to file or directory [man] create a physical link to file or directory [man] view files of directory [man] view files of directory [man] show details of files and directory [man] show hidden files [man] show files and directory containing numbers [man] show files and directories in a tree starting from root(2) [man] create a directory called 'dir1' [man] create two directories simultaneously [man] create a directory tree [man] rename / move a file or directory [man] show the path of work directory [man] delete file called 'file1' [man] remove a directory called 'dir1' and contents recursively [man] remove two directories and their contents recursively [man] delete directory called 'dir1' [man] modify timestamp of a file or directory (YYMMDDhhmm) [man] show files and directories in a tree starting from root(1) [man] Linux Command Line written by LinuxGuide.it (Credits)

TOP

3 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

File search
Command # find / -name file1 # find / -user user1 # find /home/user1 -name \*.bin # find /usr/bin -type f -atime +100 # find /usr/bin -type f -mtime -10 # find / -name *.rpm -exec chmod 755 '{}' \; # find / -xdev -name \*.rpm Description search file and directory into root filesystem from '/' [man] search files and directories belonging to 'user1' [man] search files with '. bin' extension within directory '/ home/user1' [man] search binary files are not used in the last 100 days [man] search files created or changed within 10 days [man] search files with '.rpm' extension and modify permits [man] search files with '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc. [man] find files with the '.ps' extension - first run 'updatedb' command [man] show location of a binary file, source or man [man] show full path to a binary / executable [man] Linux Command Line written by LinuxGuide.it (Credits) TOP

# locate \*.ps # whereis halt # which halt

Mounting a Filesystem
Command # fuser -km /mnt/hda2 # mount /dev/hda2 /mnt/hda2 # mount /dev/fd0 /mnt/floppy # mount /dev/cdrom /mnt/cdrom # mount /dev/hdc /mnt/cdrecorder # mount /dev/hdb /mnt/cdrecorder # mount -o loop file.iso /mnt/cdrom # mount -t vfat /dev/hda5 /mnt/hda5 # mount /dev/sda1 /mnt/usbdisk Description force umount when the device is busy [man] mount disk called hda2 - verify existence of the directory '/ mnt/hda2' [man] mount a floppy disk [man] mount a cdrom / dvdrom [man] mount a cdrw / dvdrom [man] mount a cdrw / dvdrom [man] mount a file or iso image [man] mount a Windows FAT32 file system [man] mount a usb pen-drive or flash-drive [man]

4 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# mount -t smbfs -o username=user,password=pass //WinClient /share /mnt/share # umount /dev/hda2 # umount -n /mnt/hda2

mount a windows network share [man]

unmount disk called hda2 - exit from mount point '/ mnt/hda2' first [man] run umount without writing the file /etc/mtab useful when the file is read-only or the hard disk is full [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

Disk Space
Command # df -h # dpkg-query -W -f='${InstalledSize;10}t${Package}n' | sort -k1,1n # du -sh dir1 # du -sk * | sort -rn # ls -lSr |more Description show list of partitions mounted [man] show the used space by installed deb packages, sorting by size (debian, ubuntu and alike) [man] estimate space used by directory 'dir1' [man] show size of the files and directories sorted by size [man] show size of the files and directories ordered by size [man]

# rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort show the used space by rpm packages installed -k1,1n sorted by size (fedora, redhat and alike) [man] Linux Command Line written by LinuxGuide.it (Credits) TOP

Users and Groups


Command # chage -E 2005-12-31 user1 # groupadd [group] # groupdel [group] # groupmod -n moon sun # grpck # newgrp - [group] # passwd Description set deadline for user password [man] create a new group [man] delete a group [man] rename a group from moon to sun [man] check correct syntax and file format of '/etc/group' and groups existence [man] log into a new group to change default group of newly created files [man] change password [man]

5 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# passwd user1 # pwck # useradd -c "User Linux" -g admin -d /home/user1 -s /bin/bash user1 # useradd user1 # userdel -r user1

change a user password (only by root) [man] check correct syntax and file format of '/etc/passwd' and users existence [man] create a new user "user1" belongs "admin" group [man] create a new user [man] delete a user ( '-r' eliminates home directory) [man]

# usermod -c "User FTP" -g system -d /ftp/user1 change user attributes as description, group and -s /bin/nologin user1 other [man] Linux Command Line written by LinuxGuide.it (Credits) TOP

Permits on Files
Command # chgrp group1 file1 # chmod ugo+rwx directory1 # chmod go-rwx directory1 # chmod u+s /bin/file1 # chmod u-s /bin/file1 # chmod g+s /home/public # chmod g-s /home/public # chmod o+t /home/public # chmod o-t /home/public # chown user1 file1 # chown -R user1 directory1 # chown user1:group1 file1 # find / -perm -u+s # ls -lh # ls /tmp | pr -T5 -W$COLUMNS TOP Description change group of files [man] set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o) [man] remove permits reading (r), write (w) and (x) access to users group (g) and others (or [man] set SUID bit on a binary file - the user that running that file gets same privileges as owner [man] disable SUID bit on a binary file [man] set SGID bit on a directory - similar to SUID but for directory [man] disable SGID bit on a directory [man] set STIKY bit on a directory - allows files deletion only to legitimate owners [man] disable STIKY bit on a directory [man] change owner of a file [man] change user owner of a directory and all the files and directories contained inside [man] change user and group ownership of a file [man] view all files on the system with SUID configured [man] show permits on files [man] divide terminal into 5 columns [man]

Linux Command Line written by LinuxGuide.it (Credits)

6 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Special Attributes on files


Command # chattr +a file1 # chattr +c file1 # chattr +d file1 # chattr +i file1 # chattr +s file1 # chattr +S file1 # chattr +u file1 # lsattr TOP Description allows write opening of a file only append mode [man] allows that a file is compressed / decompressed automatically by the kernel [man] makes sure that the program ignores Dump the files during backup [man] makes it an immutable file, which can not be removed, altered, renamed or linked [man] allows a file to be deleted safely [man] makes sure that if a file is modified changes are written in synchronous mode as with sync [man] allows you to recover the contents of a file even if it is canceled [man] show specials attributes [man] Linux Command Line written by LinuxGuide.it (Credits)

Archives and compressed files


Command # bunzip2 file1.bz2 # bzip2 file1 # gunzip file1.gz # gzip file1 # gzip -9 file1 # rar a file1.rar test_file # rar a file1.rar file1 file2 dir1 # rar x file1.rar # tar -cvf archive.tar file1 # tar -cvf archive.tar file1 file2 dir1 # tar -tf archive.tar # tar -xvf archive.tar Description decompress a file called 'file1.bz2' [man] compress a file called 'file1' [man] decompress a file called 'file1.gz' [man] compress a file called 'file1' [man] compress with maximum compression [man] create an archive rar called 'file1.rar' [man] compress 'file1', 'file2' and 'dir1' simultaneously [man] decompress rar archive [man] create a uncompressed tarball [man] create an archive containing 'file1', 'file2' and 'dir1' [man] show contents of an archive [man] extract a tarball [man]

7 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# tar -xvf archive.tar -C /tmp # tar -cvfj archive.tar.bz2 dir1 # tar -xvfj archive.tar.bz2 # tar -cvfz archive.tar.gz dir1 # tar -xvfz archive.tar.gz # unrar x file1.rar # unzip file1.zip # zip file1.zip file1 # zip -r file1.zip file1 file2 dir1

extract a tarball into / tmp [man] create a tarball compressed into bzip2 [man] decompress a compressed tar archive in bzip2 [man] create a tarball compressed into gzip [man] decompress a compressed tar archive in gzip [man] decompress rar archive [man] decompress a zip archive [man] create an archive compressed in zip [man] compress in zip several files and directories simultaneously [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

RPM Packages ( Fedora, Red Hat and like)


Command # rpm -ivh [package.rpm] # rpm -ivh --nodeeps [package.rpm] # rpm -U [package.rpm] # rpm -F [package.rpm] # rpm -e [package] # rpm -qa # rpm -qa | grep httpd # rpm -qi [package] # rpm -qg "System Environment/Daemons" # rpm -ql [package] # rpm -qc [package] # rpm -q [package] --whatrequires # rpm -q [package] --whatprovides Description install a rpm package [man] install a rpm package ignoring dependencies requests [man] upgrade a rpm package without changing configuration files [man] upgrade a rpm package only if it is already installed [man] remove a rpm package [man] show all rpm packages installed on the system [man] show all rpm packages with the name "httpd" [man] obtain information on a specific package installed [man] show rpm packages of a group software [man] show list of files provided by a rpm package installed [man] show list of configuration files provided by a rpm package installed [man] show list of dependencies required for a rpm packet [man] show capability provided by a rpm package [man]

8 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# rpm -q [package] --scripts # rpm -q [package] --changelog # rpm -qf /etc/httpd/conf/httpd.conf # rpm -qp [package.rpm] -l # rpm --import /media/cdrom/RPM-GPG-KEY # rpm --checksig [package.rpm] # rpm -qa gpg-pubkey # rpm -V [package] # rpm -Va # rpm -Vp [package.rpm] # rpm -ivh /usr/src/redhat/RPMS/`arch` /[package.rpm] # rpm2cpio [package.rpm] | cpio --extract --make-directories *bin* # rpmbuild --rebuild [package.src.rpm] TOP

show scripts started during installation / removal [man] show history of revisions of a rpm package [man] verify which rpm package belongs to a given file [man] show list of files provided by a rpm package not yet installed [man] import public-key digital signature [man] verify the integrity of a rpm package [man] verify integrity of all rpm packages installed [man] check file size, permissions, type, owner, group, MD5 checksum and last modification [man] check all rpm packages installed on the system - use with caution [man] verify a rpm package not yet installed [man] install a package built from a rpm source [man] extract executable file from a rpm package [man] build a rpm package from a rpm source [man]

Linux Command Line written by LinuxGuide.it (Credits)

YUM packages tool (Fedora, RedHat and alike)


Command # yum -y install [package] # yum localinstall [package.rpm] Description download and install a rpm package [man] That will install an RPM, and try to resolve all the dependencies for you using your repositories. [man] update all rpm packages installed on the system [man] upgrade a rpm package [man] remove a rpm package [man] list all packages installed on the system [man] find a package on rpm repository [man] clean up rpm cache erasing downloaded packages [man] remove all files headers that the system uses to resolve dependency [man]

# yum -y update # yum update [package] # yum remove [package] # yum list # yum search [package] # yum clean [package] # yum clean headers

9 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# yum clean all

remove from the cache packages and headers files [man] Linux Command Line written by LinuxGuide.it (Credits)

TOP

DEB packages (Debian, Ubuntu and like)


Command # dpkg -i [package.deb] # dpkg -r [package] # dpkg -l # dpkg -l | grep httpd # dpkg -s [package] # dpkg -L [package] # dpkg --contents [package.deb] # dpkg -S /bin/ping TOP Description install / upgrade a deb package [man] remove a deb package from the system [man] show all deb packages installed on the system [man] show all deb packages with the name "httpd" [man] obtain information on a specific package installed on system [man] show list of files provided by a package installed on system [man] show list of files provided by a package not yet installed [man] verify which package belongs to a given file [man] Linux Command Line written by LinuxGuide.it (Credits)

APT packages tool (Debian, Ubuntu and alike)


Command # apt-cache search [package] # apt-cdrom install [package] # apt-get install [package] # apt-get update # apt-get upgrade # apt-get remove [package] # apt-get check # apt-get clean TOP Description returns list of packages which corresponds string "searched-packages" [man] install / upgrade a deb package from cdrom [man] install / upgrade a deb package [man] update the package list [man] upgrade all of the installed packages [man] remove a deb package from system [man] verify correct resolution of dependencies [man] clean up cache from packages downloaded [man] Linux Command Line written by LinuxGuide.it (Credits)

10 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Pacman packages tool (Arch, Frugalware and alike)


Command # pacman -S name # pacman -R name TOP Description Install package 'name' with dependencies [man] Delete package 'name' and all files of it [man] Linux Command Line written by LinuxGuide.it (Credits)

View file content


Command # cat file1 # head -2 file1 # less file1 Description view the contents of a file starting from the first row [man] view first two lines of a file [man] similar to 'more' command but which allows backward movement in the file as well as forward movement [man] view content of a file along [man] view the contents of a file starting from the last line [man] view last two lines of a file [man] view in real time what is added to a file [man] Linux Command Line written by LinuxGuide.it (Credits) TOP

# more file1 # tac file1 # tail -2 file1 # tail -f /var/log/messages

Text Manipulation
Command # cat example.txt | awk 'NR%2==1' # echo a b c | awk '{print $1}' # echo a b c | awk '{print $1,$3}' # cat -n file1 # comm -1 file1 file2 Description remove all even lines from example.txt [man] view the first column of a line [man] view the first and third column of a line [man] number row of a file [man] compare contents of two files by deleting only unique lines from 'file1' [man]

11 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# comm -2 file1 file2 # comm -3 file1 file2 # diff file1 file2 # grep Aug /var/log/messages # grep ^Aug /var/log/messages # grep [0-9] /var/log/messages # grep Aug -R /var/log/* # paste file1 file2 # paste -d '+' file1 file2 # sdiff file1 file2 # sed 's/string1/string2/g' example.txt # sed '/^$/d' example.txt # sed '/ *#/d; /^$/d' example.txt # sed -e '1d' exampe.txt # sed -n '/string1/p' # sed -e 's/ *$//' example.txt # sed -e 's/string1//g' example.txt # sed -n '1,5p' example.txt # sed -n '5p;5q' example.txt # sed -e 's/00*/0/g' example.txt # sort file1 file2 # sort file1 file2 | uniq # sort file1 file2 | uniq -u # sort file1 file2 | uniq -d # echo 'word' | tr '[:lower:]' '[:upper:]'

compare contents of two files by deleting only unique lines from 'file2' [man] compare contents of two files by deleting only the lines that appear on both files [man] find differences between two files [man] look up words "Aug" on file '/var/log/messages' [man] look up words that begin with "Aug" on file '/var/log /messages' [man] select from file '/var/log/messages' all lines that contain numbers [man] search string "Aug" at directory '/var/log' and below [man] merging contents of two files for columns [man] merging contents of two files for columns with '+' delimiter on the center [man] find differences between two files and merge interactively alike "diff" [man] replace "string1" with "string2" in example.txt [man] remove all blank lines from example.txt [man] remove comments and blank lines from example.txt [man] eliminates the first line from file example.txt [man] view only lines that contain the word "string1" [man] remove empty characters at the end of each row [man] remove only the word "string1" from text and leave intact all [man] print from 1th to 5th row of example.txt [man] print row number 5 of example.txt [man] replace more zeros with a single zero [man] sort contents of two files [man] sort contents of two files omitting lines repeated [man] sort contents of two files by viewing only unique line [man] sort contents of two files by viewing only duplicate line [man] convert from lower case in upper case [man]

12 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Linux Command Line written by LinuxGuide.it (Credits) TOP

Character set and Format file conversion


Command # dos2unix filedos.txt fileunix.txt # recode ..HTML < page.txt > page.html # recode -l | more # unix2dos fileunix.txt filedos.txt Description convert a text file format from MSDOS to UNIX [man] convert a text file to html [man] show all available formats conversion [man] convert a text file format from UNIX to MSDOS [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

Filesystem Analysis
Command # badblocks -v /dev/hda1 # dosfsck /dev/hda1 # e2fsck /dev/hda1 # e2fsck -j /dev/hda1 # fsck /dev/hda1 # fsck.ext2 /dev/hda1 # fsck.ext3 /dev/hda1 # fsck.vfat /dev/hda1 # fsck.msdos /dev/hda1 Description check bad blocks on disk hda1 [man] repair / check integrity of dos filesystems on disk hda1 [man] repair / check integrity of ext2 filesystem on disk hda1 [man] repair / check integrity of ext3 filesystem on disk hda1 [man] repair / check integrity of linux filesystem on disk hda1 [man] repair / check integrity of ext2 filesystem on disk hda1 [man] repair / check integrity of ext3 filesystem on disk hda1 [man] repair / check integrity of fat filesystem on disk hda1 [man] repair / check integrity of dos filesystem on disk hda1 [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

13 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Format a Filesystem
Command # fdformat -n /dev/fd0 # mke2fs /dev/hda1 # mke2fs -j /dev/hda1 # mkfs /dev/hda1 # mkfs -t vfat 32 -F /dev/hda1 # mkswap /dev/hda3 TOP Description format a floppy disk [man] create a filesystem type linux ext2 on hda1 partition [man] create a filesystem type linux ext3 (journal) on hda1 partition [man] create a filesystem type linux on hda1 partition [man] create a FAT32 filesystem [man] create a swap filesystem [man] Linux Command Line written by LinuxGuide.it (Credits)

Filesystem SWAP
Command # mkswap /dev/hda3 # swapon /dev/hda3 # swapon /dev/hda2 /dev/hdb3 TOP Description create a swap filesystem [man] activating a new swap partition [man] activate two swap partitions [man]

Linux Command Line written by LinuxGuide.it (Credits)

Backup
Command # find /var/log -name '*.log' | tar cv --filesfrom=- | bzip2 > log.tar.bz2 # find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents # dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' # dd if=/dev/sda of=/tmp/file1 # dd if=/dev/hda of=/dev/fd0 bs=512 count=1 Description find all files with '.log' extention and make an bzip archive [man] find and copy all files with '.txt' extention from a directory to another [man] make a backup of a local hard disk on remote host via ssh [man] backup content of the harddrive to a file [man] make a copy of MBR (Master Boot Record) to floppy [man]

14 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# dd if=/dev/fd0 of=/dev/hda bs=512 count=1 # dump -0aj -f /tmp/home0.bak /home # dump -1aj -f /tmp/home0.bak /home # restore -if /tmp/home0.bak # rsync -rogpav --delete /home /tmp # rsync -rogpav -e ssh --delete /home ip_address:/tmp

restore MBR from backup copy saved to floppy [man] make a full backup of directory '/home' [man] make a incremental backup of directory '/home' [man] restoring a backup interactively [man] synchronization between directories [man] rsync via SSH tunnel [man]

# rsync -az -e ssh --delete ip_addr:/home/public synchronize a local directory with a remote /home/local directory via ssh and compression [man] # rsync -az -e ssh --delete /home/local ip_addr:/home/public # tar -Puf backup.tar /home/user # ( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' # ( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' # tar cf - . | (cd /tmp/backup ; tar xf - ) synchronize a remote directory with a local directory via ssh and compression [man] make a incremental backup of directory '/home/user' [man] copy content of a directory on remote directory via ssh [man] copy a local directory on remote directory via ssh [man] local copy preserving permits and links from a directory to another [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

CDROM
Command # cd-paranoia -B # cd-paranoia -# cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force # cdrecord -v dev=/dev/cdrom cd.iso Description rip audio tracks from a CD to wav files [man] rip first three audio tracks from a CD to wav files [man] clean a rewritable cdrom [man] burn an ISO image [man]

# gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom burn a compressed ISO image [man] # cdrecord --scanbus # dd if=/dev/hdc | md5sum # mkisofs /dev/cdrom > cd.iso # mkisofs /dev/cdrom | gzip > cd_iso.gz scan bus to identify the channel scsi [man] perform an md5sum on a device, like a CD [man] create an iso image of cdrom on disk [man] create a compressed iso image of cdrom on disk [man]

15 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# mkisofs -J -allow-leading-dots -R -V # mount -o loop cd.iso /mnt/iso TOP

create an iso image of a directory [man] mount an ISO image [man]

Linux Command Line written by LinuxGuide.it (Credits)

Networking (LAN / WiFi)


Command # dhclient eth0 # ethtool eth0 # host www.example.com # hostname # ifconfig eth0 # ifconfig eth0 192.168.1.1 netmask 255.255.255.0 # ifconfig eth0 promisc # ifdown eth0 # ifup eth0 # ip link show # iwconfig eth1 # iwlist scan # mii-tool eth0 # netstat -tup # netstat -tupl # netstat -rn # nslookup www.example.com # route -n # route add -net 0/0 gw IP_Gateway # route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 # route del 0/0 gw IP_gateway # echo "1" > /proc/sys/net/ipv4/ip_forward Description active interface 'eth0' in dhcp mode [man] show network statistics of eth0 [man] lookup hostname to resolve name to ip address and viceversa [man] show hostname of system [man] show configuration of an ethernet network card [man] configure IP Address [man] configure 'eth0' in promiscuous mode to gather packets (sniffing) [man] disable an interface 'eth0' [man] activate an interface 'eth0' [man] show link status of all network interfaces [man] show wireless networks [man] wifi scanning to display the wireless connections available [man] show link status of 'eth0' [man] show all active network connections and their PID [man] show all network services listening on the system and their PID [man] show routing table alike "route -n" [man] lookup hostname to resolve name to ip address and viceversa [man] show routing table [man] configure default gateway [man] configure static route to reach network '192.168.0.0/16' [man] remove static route [man] activate ip routing temporarily [man]

16 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

# tcpdump tcp port 80 # whois www.example.com TOP

show all HTTP traffic [man] lookup on Whois database [man] Linux Command Line written by LinuxGuide.it (Credits)

Microsoft Windows networks (samba)


Command # mount -t smbfs -o username=user,password=pass //WinClient /share /mnt/share # nbtscan ip_addr # nmblookup -A ip_addr # smbclient -L ip_addr/hostname # smbget -Rr smb://ip_addr/share Description mount a windows network share [man]

netbios name resolution [man] netbios name resolution [man] show remote shares of a windows host [man] like wget can download files from a host windows via smb [man]

Linux Command Line written by LinuxGuide.it (Credits) TOP

IPTABLES (firewall)
Command # iptables -t filter -L # iptables -t nat -L # iptables -t filter -F # iptables -t nat -F # iptables -t filter -X Description show all chains of filtering table [man] show all chains of nat table [man] clear all rules from filtering table [man] clear all rules from table nat [man] delete any chains created by user [man]

# iptables -t filter -A INPUT -p tcp --dport telnet allow telnet connections to input [man] -j ACCEPT # iptables -t filter -A OUTPUT -p tcp --dport http -j DROP # iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT block HTTP connections to output [man] allow POP3 connections to forward chain [man]

# iptables -t filter -A INPUT -j LOG --log-prefix Logging on input chain [man] # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 configure a PAT (Port Address Traslation) on eth0 masking outbound packets [man] redirect packets addressed to a host to another host [man]

17 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

Linux Command Line written by LinuxGuide.it (Credits) TOP

Monitoring and debugging


Command # free -m # kill -9 process_id # kill -1 process_id # last reboot # lsmod # lsof -p process_id # lsof /home/user1 # ps -eafw # ps -e -o pid,args --forest # pstree # smartctl -A /dev/hda # smartctl -i /dev/hda # strace -c ls >/dev/null # strace -f -e open ls >/dev/null # tail /var/log/dmesg # tail /var/log/messages # top # watch -n1 'cat /proc/interrupts' TOP Description displays status of RAM in megabytes [man] force closure of the process and finish it [man] force a process to reload configuration [man] show history reboot [man] display kernel loaded [man] display a list of files opened by processes [man] displays a list of open files in a given path system [man] displays linux tasks [man] displays linux tasks in a hierarchical mode [man] Shows a tree system processes [man] monitoring reliability of a hard-disk through SMART [man] check if SMART is active on a hard-disk [man] display system calls made and received by a process [man] display library calls [man] show events inherent to the process of booting kernel [man] show system events [man] display linux tasks using most cpu [man] display interrupts in real-time [man] Linux Command Line written by LinuxGuide.it (Credits)

Others useful commands


Command # alias hh='history' # apropos ...keyword Description set an alias for a command - hh = history [man] display a list of commands that pertain to keywords of a program , useful when you know what your program does, but you don't know the name of the

18 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

command [man] # chsh # chsh --list-shells # gpg -c file1 # gpg file1.gpg # ldd /usr/bin/ssh # man ping change shell command [man] nice command to know if you have to remote into another box [man] encrypt a file with GNU Privacy Guard [man] decrypt a file with GNU Privacy Guard [man] show shared libraries required by ssh program [man] display the on-line manual pages for example on ping command - use '-k' option to find any related commands [man] create a boot floppy [man] download an entire web site [man] download a file with the ability to stop the download and resume later [man]

# mkbootdisk --device /dev/fd0 `uname -r` # wget -r www.example.com # wget -c www.example.com/file.iso

# echo 'wget -c www.example.com/files.iso' | at start a download at any given time [man] 09:00 # whatis ...keyword # who -a displays description of what a program does [man] show who is logged on, and print: time of last system boot, dead processes, system login processes, active processes spawned by init, current runlevel, last system clock change [man] Linux Command Line written by LinuxGuide.it (Credits) TOP

Terms and License of Use


Except where otherwise specified, the contents of linuxguide.it are licensed under: "License Creative Commons" Attribution-Noncommercial-No Derivative Works You are free: to Share to copy, and transmit the work EXCEPT distribute it through webserver/torrent without authorization from linuxguide.it (Download can be done only from official site and authorized mirror) Official prymary mirror: http://www.linuxguide.it Under the following conditions: Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial You may not use this work for commercial purposes.

19 of 20

14/11/2011 19:27

Linux Command Line in English - LinuxGuide.it/commands

file:///H:/Materi Kuliah Semester 7/Praktikum/Praktikum Sistem Opera...

No Derivative Works You may not alter, transform, or build upon this work. For any reuse or distribution, you must make clear to others the licence terms of this work. Any of the above conditions can be waived if you get permission from the copyright holder. The author's moral rights are retained in this licence. Conditions for use Linux Command Line's commands: USE AT YOUR OWN RISK . YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM THE USE OF ANY SUCH MATERIAL.

TOP

Credits (Accredited Translators)


Translate in your language(on line) Suggest a new Language! Individuals we'd like to thank include: NAME/NICK CONTRIBUTION Abdullah EL Hejory MEG the-ghost Mahmoud Ahmed Ihar Hrachyshka Eric Neon foolfrog Radek T ka LinuxGuide.it team Mario Hosein-mec Vahid Ghoreishi lolo44 elahistos Fotis Tsamis sonicy D. Rigattieri Mateusz Tybura CTAHOK (ar) Arabic translation (ar) Arabic translation (ar) Arabic translation (ar) Arabic translation (by) Belarusian translation (cn) Chinese translation (cn) Chinese translation (cz) Czech Republic translation and proofreading (en) Foundation and Maintenance of Linux Command Line (es) Spanish translation and proofreading (fa) Persian translation (fa) Persian translation (fr) French translation (gr) Greek translation (gr) Greek translation (gr) Greek translation (it) Italian translation (pl) Polish translation and proofreading (ru) Russian translation WWW WWW WWW WWW WWW WWW WWW

URL WWW WWW WWW WWW WWW WWW

20 of 20

14/11/2011 19:27

Vous aimerez peut-être aussi