Popis komandi


Autor ovih popisa komandi ne daje nikakvu garanciju za njih i koristite ih na svoju odgovornost!

Prvi dio       Drugi dio


-->

DEB packages (Debian, Ubuntu and like)

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

APT packages tool (Debian, Ubuntu and alike)

Command Description
# apt-cache search [package] returns list of packages which corresponds string "searched-packages"   [man]
# apt-cdrom install [package] install / upgrade a deb package from cdrom   [man]
# apt-get install [package] install / upgrade a deb package   [man]
# apt-get update update the package list   [man]
# apt-get upgrade upgrade all of the installed packages   [man]
# apt-get remove [package] remove a deb package from system   [man]
# apt-get check verify correct resolution of dependencies   [man]
# apt-get clean clean up cache from packages downloaded   [man]
 

Pacman packages tool (Arch, Frugalware and alike)

Command Description
# pacman -S name Install package 'name' with dependencies   [man]
# pacman -R name Delete package 'name' and all files of it   [man]
 

View file content

Command Description
# cat file1 view the contents of a file starting from the first row   [man]
# head -2 file1 view first two lines of a file   [man]
# less file1 similar to 'more' command but which allows backward movement in the file as well as forward movement   [man]
# more file1 view content of a file along   [man]
# tac file1 view the contents of a file starting from the last line   [man]
# tail -2 file1 view last two lines of a file   [man]
# tail -f /var/log/messages view in real time what is added to a file   [man]
 

Text Manipulation

Command Description
# cat example.txt | awk 'NR%2==1' remove all even lines from example.txt   [man]
# echo a b c | awk '{print $1}' view the first column of a line   [man]
# echo a b c | awk '{print $1,$3}' view the first and third column of a line   [man]
# cat -n file1 number row of a file   [man]
# comm -1 file1 file2 compare contents of two files by deleting only unique lines from 'file1'   [man]
# comm -2 file1 file2 compare contents of two files by deleting only unique lines from 'file2'   [man]
# comm -3 file1 file2 compare contents of two files by deleting only the lines that appear on both files   [man]
# diff file1 file2 find differences between two files   [man]
# grep Aug /var/log/messages look up words "Aug" on file '/var/log/messages'   [man]
# grep ^Aug /var/log/messages look up words that begin with "Aug" on file '/var/log/messages'   [man]
# grep [0-9] /var/log/messages select from file '/var/log/messages' all lines that contain numbers   [man]
# grep Aug -R /var/log/* search string "Aug" at directory '/var/log' and below   [man]
# paste file1 file2 merging contents of two files for columns   [man]
# paste -d '+' file1 file2 merging contents of two files for columns with '+' delimiter on the center   [man]
# sdiff file1 file2 find differences between two files and merge interactively alike "diff"   [man]
# sed 's/string1/string2/g' example.txt replace "string1" with "string2" in example.txt   [man]
# sed '/^$/d' example.txt remove all blank lines from example.txt   [man]
# sed '/ *#/d; /^$/d' example.txt remove comments and blank lines from example.txt   [man]
# sed -e '1d' exampe.txt eliminates the first line from file example.txt   [man]
# sed -n '/string1/p' view only lines that contain the word "string1"   [man]
# sed -e 's/ *$//' example.txt remove empty characters at the end of each row   [man]
# sed -e 's/string1//g' example.txt remove only the word "string1" from text and leave intact all   [man]
# sed -n '1,5p' example.txt print from 1th to 5th row of example.txt   [man]
# sed -n '5p;5q' example.txt print row number 5 of example.txt   [man]
# sed -e 's/00*/0/g' example.txt replace more zeros with a single zero   [man]
# sort file1 file2 sort contents of two files   [man]
# sort file1 file2 | uniq sort contents of two files omitting lines repeated   [man]
# sort file1 file2 | uniq -u sort contents of two files by viewing only unique line   [man]
# sort file1 file2 | uniq -d sort contents of two files by viewing only duplicate line   [man]
# echo 'word' | tr '[:lower:]' '[:upper:]' convert from lower case in upper case   [man]
 

Character set and Format file conversion

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

Filesystem Analysis

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

Format a Filesystem

Command Description
# fdformat -n /dev/fd0 format a floppy disk   [man]
# mke2fs /dev/hda1 create a filesystem type linux ext2 on hda1 partition   [man]
# mke2fs -j /dev/hda1 create a filesystem type linux ext3 (journal) on hda1 partition   [man]
# mkfs /dev/hda1 create a filesystem type linux on hda1 partition   [man]
# mkfs -t vfat 32 -F /dev/hda1 create a FAT32 filesystem   [man]
# mkswap /dev/hda3 create a swap filesystem   [man]
 

Filesystem SWAP

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

Backup

Command Description
# find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 find all files with '.log' extention and make an bzip archive   [man]
# find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents find and copy all files with '.txt' extention from a directory to another   [man]
# dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk on remote host via ssh   [man]
# dd if=/dev/sda of=/tmp/file1 backup content of the harddrive to a file   [man]
# dd if=/dev/hda of=/dev/fd0 bs=512 count=1 make a copy of MBR (Master Boot Record) to floppy   [man]
# dd if=/dev/fd0 of=/dev/hda bs=512 count=1 restore MBR from backup copy saved to floppy   [man]
# dump -0aj -f /tmp/home0.bak /home make a full backup of directory '/home'   [man]
# dump -1aj -f /tmp/home0.bak /home make a incremental backup of directory '/home'   [man]
# restore -if /tmp/home0.bak restoring a backup interactively   [man]
# rsync -rogpav --delete /home /tmp synchronization between directories   [man]
# rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync via SSH tunnel   [man]
# rsync -az -e ssh --delete ip_addr:/home/public /home/local synchronize a local directory with a remote directory via ssh and compression   [man]
# rsync -az -e ssh --delete /home/local ip_addr:/home/public synchronize a remote directory with a local directory via ssh and compression   [man]
# tar -Puf backup.tar /home/user make a incremental backup of directory '/home/user'   [man]
# ( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' copy content of a directory on remote directory via ssh   [man]
# ( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' copy a local directory on remote directory via ssh   [man]
# tar cf - . | (cd /tmp/backup ; tar xf - ) local copy preserving permits and links from a directory to another   [man]
 

CDROM

Command Description
# cd-paranoia -B rip audio tracks from a CD to wav files   [man]
# cd-paranoia -- rip first three audio tracks from a CD to wav files   [man]
# cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force clean a rewritable cdrom   [man]
# cdrecord -v dev=/dev/cdrom cd.iso burn an ISO image   [man]
# gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - burn a compressed ISO image   [man]
# cdrecord --scanbus scan bus to identify the channel scsi   [man]
# dd if=/dev/hdc | md5sum perform an md5sum on a device, like a CD   [man]
# mkisofs /dev/cdrom > cd.iso create an iso image of cdrom on disk   [man]
# mkisofs /dev/cdrom | gzip > cd_iso.gz create a compressed iso image of cdrom on disk   [man]
# mkisofs -J -allow-leading-dots -R -V create an iso image of a directory   [man]
# mount -o loop cd.iso /mnt/iso mount an ISO image   [man]
 

Networking (LAN / WiFi)

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

Microsoft Windows networks (samba)

Command Description
# mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share mount a windows network share   [man]
# nbtscan ip_addr netbios name resolution   [man]
# nmblookup -A ip_addr netbios name resolution   [man]
# smbclient -L ip_addr/hostname show remote shares of a windows host   [man]
# smbget -Rr smb://ip_addr/share like wget can download files from a host windows via smb   [man]
 

IPTABLES (firewall)

Command Description
# iptables -t filter -L show all chains of filtering table   [man]
# iptables -t nat -L show all chains of nat table   [man]
# iptables -t filter -F clear all rules from filtering table   [man]
# iptables -t nat -F clear all rules from table nat   [man]
# iptables -t filter -X delete any chains created by user   [man]
# iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input   [man]
# iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block http connections to output   [man]
# iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT 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 configure a PAT (Port Address Traslation) on eth0 masking outbound packets   [man]
# 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 redirect packets addressed to a host to another host   [man]
 

Monitoring and debugging

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

Others useful commands

Command Description
# alias hh='history' set an alias for a command - hh = history   [man]
# apropos ...keyword 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 command   [man]
# chsh change shell command   [man]
# chsh --list-shells nice command to know if you have to remote into another box   [man]
# gpg -c file1 encrypt a file with GNU Privacy Guard   [man]
# gpg file1.gpg decrypt a file with GNU Privacy Guard   [man]
# ldd /usr/bin/ssh show shared libraries required by ssh program   [man]
# man ping display the on-line manual pages for example on ping command - use '-k' option to find any related commands   [man]
# mkbootdisk --device /dev/fd0 `uname -r` create a boot floppy   [man]
# wget -r www.example.com download an entire web site   [man]
# wget -c www.example.com/file.iso download a file with the ability to stop the download and resume later   [man]
# echo 'wget -c www.example.com/files.iso' | at 09:00 start a download at any given time   [man]
# whatis ...keyword displays description of what a program does   [man]
# who -a 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]



Ovaj popis komandi je kopiran sa stranice linuxguide.it koji je pod Creative Common licencom. Citat sa njihove stranice: Except where otherwise specified, the contents of LinuGuide.it are licensed under License Creative Commons 2.5 Attribution Free Distribution if provided Authors and, Not Commercial purposes and, Not Derivated Works 2.5
Puno hvala autorima!!


Na vrh


 
 

eXTReMe Tracker