System information
archshow architecture of machine(1)
uname -mshow architecture of machine(2)
uname -rshow used kernel version
dmidecode -qshow hardware system components - (SMBIOS / DMI)
hdparm -i /dev/hdadisplays the characteristics of a hard-disk
hdparm -tT /dev/sdaperform test reading on a hard-disk
cat /proc/cpuinfoshow information CPU info
cat /proc/interruptsshow interrupts
cat /proc/meminfoverify memory use
cat /proc/swapsshow file(s) swap
cat /proc/versionshow version of the kernel
cat /proc/net/devshow network adpters and statistics
cat /proc/mountsshow mounted file system(s)
lspci -tvdisplay PCI devices
lsusb -tvshow USB devices
dateshow system date
cal 2007show the timetable of 2007
date 041217002007.00 set date and time - MonthDayhoursMinutesYear.Seconds
clock -w
save date changes on BIOS
Shutdown (Restart of a system and Logout )
shutdown -h nowshutdown system(1)
init 0 shutdown system(2)
telinit 0 shutdown system(3)
shutdown -h hours:minutes &planned shutdown of the system
shutdown -ccancel a planned shutdown of the system
shutdown -r nowreboot(1)
rebootreboot(2)
logoutleaving session
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Files and Directory
cd /homeenter to directory '/ home'
cd ..go back one level
cd ../..go back two levels
cdgo to home directory
cd ~user1go to home directory
cd -go to previous directory
pwdshow the path of work directory
lsview files of directory
ls -Fview files of directory
ls -lshow details of files and directory
ls -ashow hidden files
ls *[0-9]*show files and directory containing numbers
treeshow files and directories in a tree starting from root(1)
lstreeshow files and directories in a tree starting from root(2)
mkdir dir1create a directory called 'dir1'
mkdir dir1 dir2create two directories simultaneously
mkdir -p /tmp/dir1/dir2create a directory tree
rm -f file1delete file called 'file1'
rmdir dir1 delete directory called 'dir1'
rm -rf dir1remove a directory called 'dir1' and contents recursively
rm -rf dir1 dir2remove two directories and their contents recursively
mv dir1 new_dirrename / move a file or directory
cp file1 file2copying a file
cp dir/* .copy all files of a directory within the current work directory
cp -a /tmp/dir1 .copy a directory within the current work directory
cp -a dir1 dir2copy a directory
ln -s file1 lnk1 create a symbolic link to file or directory
ln file1 lnk1create a physical link to file or directory
touch -t 0712250000 file1 modify timestamp of a file or directory - (YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -llists known encodings
iconv -f fromEncoding -t toEncoding inputFile > outputFilecreates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \;batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
File search
find / -name file1search file and directory into root filesystem from '/'
find / -user user1search files and directories belonging to 'user1'
find /home/user1 -name \*.binsearch files with '. bin' extension within directory '/ home/user1' 
find /usr/bin -type f -atime +100search binary files are not used in the last 100 days
find /usr/bin -type f -mtime -10search files created or changed within 10 days
find / -name \*.rpm -exec chmod 755 '{}' \;search files with '.rpm' extension and modify permits
find / -xdev -name \*.rpmsearch files with  '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc.…
locate \*.psfind files with the '.ps' extension - first run 'updatedb' command
whereis haltshow location of a binary file, source or man
which haltshow full path to a binary / executable
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Mounting a Filesystem
mount /dev/hda2 /mnt/hda2mount disk called hda2 - verify existence of the directory '/ mnt/hda2'
umount /dev/hda2unmount disk called hda2 - exit from mount point '/ mnt/hda2' first
fuser -km /mnt/hda2force umount when the device is busy
umount -n /mnt/hda2run umount without writing the file /etc/mtab - useful when the file is read-only or the hard disk is full
mount /dev/fd0 /mnt/floppymount a floppy disk
mount /dev/cdrom /mnt/cdrommount a cdrom / dvdrom
mount /dev/hdc /mnt/cdrecordermount a cdrw / dvdrom
mount /dev/hdb /mnt/cdrecordermount a cdrw / dvdrom
mount -o loop file.iso /mnt/cdrommount a file or iso p_w_picpath
mount -t vfat /dev/hda5 /mnt/hda5mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdiskmount a usb pen-drive or flash-drive
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/sharemount a windows network share
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Disk Space
df -hshow list of partitions mounted
ls -lSr |moreshow size of the files and directories ordered by size
du -sh dir1estimate space used by directory 'dir1'
du -sk * | sort -rn show size of the files and directories sorted by size
rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1nshow space used by rpm packages installed sorted by size (fedora, redhat and like)
dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1nshow space used by deb packages installed sorted by size (ubuntu, debian and like)
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Users and Groups
groupadd group_namecreate a new group
groupdel group_namedelete a group
groupmod -n new_group_name old_group_namerename a group
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1create a new user belongs "admin" group
useradd user1create a new user
userdel -r user1delete a user ( '-r' eliminates home directory)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1change user attributes
passwdchange password
passwd user1change a user password (only by root)
chage -E 2005-12-31 user1set deadline for user password
pwckcheck correct syntax and file format of '/etc/passwd'  and users existence
grpckcheck correct syntax and file format of '/etc/group'  and groups existence
newgrp group_namelog in to a new group to change default group of newly created files
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Permits on Files (use "+" to set permissions and "-" to remove)
ls -lhshow permits
ls /tmp | pr -T5 -W$COLUMNSdivide terminal into 5 columns
chmod ugo+rwx directory1set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o)
chmod go-rwx directory1remove permits reading (r), write (w) and (x) access to users group (g) and others (or
chown user1 file1change owner of a file
chown -R user1 directory1change user owner of a directory and all the files and directories contained inside
chgrp group1 file1change group of files
chown user1:group1 file1change user and group ownership of a file
find / -perm -u+sview all files on the system with SUID configured
chmod u+s /bin/file1set SUID bit on a binary file - the user that running that file gets same privileges as owner
chmod u-s /bin/file1disable SUID bit on a binary file
chmod g+s /home/publicset SGID bit on a directory - similar to SUID but for directory
chmod g-s /home/publicdisable SGID bit on a directory
chmod o+t /home/publicset STIKY bit on a directory - allows files deletion only to legitimate owners
chmod o-t /home/publicdisable STIKY bit on a directory
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Special Attributes on files (use "+" to set permissions and "-" to remove)
chattr +a file1allows write opening of a file only append mode
chattr +c file1allows that a file is compressed / decompressed automatically by the kernel
chattr +d file1makes sure that the program ignores Dump the files during backup
chattr +i file1makes it an immutable file, which can not be removed, altered, renamed or linked
chattr +s file1allows a file to be deleted safely
chattr +S  file1makes sure that if a file is modified changes are written in synchronous mode as with sync
chattr +u file1allows you to recover the contents of a file even if it is canceled
lsattrshow specials attributes
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Archives and compressed files
bunzip2 file1.bz2decompress a file called 'file1.bz2'
bzip2 file1compress a file called 'file1'
gunzip file1.gzdecompress a file called 'file1.gz'
gzip file1compress a file called 'file1'
gzip -9 file1compress with maximum compression
rar a file1.rar test_filecreate an archive rar called 'file1.rar'
rar a file1.rar file1 file2 dir1compress 'file1', 'file2' and 'dir1' simultaneously
rar x file1.rardecompress rar archive
unrar x file1.rardecompress rar archive
tar -cvf archive.tar file1create a uncompressed tarball
tar -cvf archive.tar file1 file2 dir1create an archive containing 'file1', 'file2' and 'dir1'
tar -tf archive.tarshow contents of an archive
tar -xvf archive.tarextract a tarball
tar -xvf archive.tar -C /tmpextract a tarball into / tmp
tar -cvfj archive.tar.bz2 dir1create a tarball compressed into bzip2
tar -xvfj archive.tar.bz2decompress a compressed tar archive in bzip2
tar -cvfz archive.tar.gz dir1create a tarball compressed into gzip
tar -xvfz archive.tar.gzdecompress a compressed tar archive in gzip
zip file1.zip file1create an archive compressed in zip
zip -r file1.zip file1 file2 dir1compress in zip several files and directories simultaneously
unzip file1.zipdecompress a zip archive
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
RPM Packages ( Fedora, Red Hat and like)
rpm -ivh package.rpminstall a rpm package
rpm -ivh --nodeeps package.rpminstall a rpm package ignoring dependencies requests
rpm -U package.rpmupgrade a rpm package without changing configuration files
rpm -F package.rpmupgrade a rpm package only if it is already installed
rpm -e package_name.rpmremove a rpm package
rpm -qashow all rpm packages installed on the system
rpm -qa | grep httpdshow all rpm packages with the name "httpd"
rpm -qi package_nameobtain information on a specific package installed
rpm -qg "System Environment/Daemons"show rpm packages of a group software
rpm -ql package_nameshow list of files provided by a rpm package installed
rpm -qc package_nameshow list of configuration files provided by a rpm package installed
rpm -q package_name --whatrequiresshow list of dependencies required for a rpm packet
rpm -q package_name --whatprovidesshow capability provided by a rpm package
rpm -q package_name --scriptsshow scripts started during installation / removal
rpm -q package_name --changelogshow history of revisions of a rpm package
rpm -qf /etc/httpd/conf/httpd.confverify which rpm package belongs to a given file
rpm -qp package.rpm  -lshow list of files provided by a rpm package not yet installed
rpm --import /media/cdrom/RPM-GPG-KEYimport public-key digital signature
rpm --checksig package.rpmverify the integrity of a rpm package
rpm -qa gpg-pubkeyverify integrity of all rpm packages installed
rpm -V package_namecheck file size, permissions, type, owner, group, MD5 checksum and last modification
rpm -Vacheck all rpm packages installed on the system - use with caution
rpm -Vp package.rpmverify a rpm package not yet installed
rpm2cpio package.rpm | cpio --extract --make-directories  *bin*extract executable file from a rpm package
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpminstall a package built from a rpm source
rpmbuild --rebuild package_name.src.rpmbuild a rpm package from a rpm source
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
YUM packages updater (Fedora, RedHat and like)
yum install package_namedownload and install a rpm package
yum localinstall package_name.rpmThat will install an RPM, and try to resolve all the dependencies for you using your repositories.
yum update package_name.rpmupdate all rpm packages installed on the system
yum update package_nameupgrade a rpm package
yum remove package_nameremove a rpm package
yum listlist all packages installed on the system
yum search package_namefind a package on rpm repository
yum clean packagesclean up rpm cache erasing downloaded packages
yum clean headersremove all files headers that the system uses to resolve dependency
yum clean allremove from the cache packages and headers files
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
DEB packages (Debian, Ubuntu and like)
dpkg -i package.debinstall / upgrade a deb package
dpkg -r package_nameremove a deb package from the system
dpkg -lshow all deb packages installed on the system
dpkg -l | grep httpdshow all deb packages with the name "httpd"
dpkg -s package_nameobtain information on a specific package installed on system
dpkg -L package_nameshow list of files provided by a package installed on system
dpkg --contents package.debshow list of files provided by a package not yet installed
dpkg -S /bin/pingverify which package belongs to a given file
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
APT packages updater (Debian, Ubuntu e like)
apt-get install package_nameinstall / upgrade a deb package
apt-cdrom install package_nameinstall / upgrade a deb package from cdrom
apt-get updateupdate the package list
apt-get upgradeupgrade all of the installed packages
apt-get remove package_nameremove a deb package from system
apt-get checkverify correct resolution of dependencies
apt-get cleanclean up cache from packages downloaded
apt-cache search searched-packagereturns list of packages which corresponds string "searched-packages"
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
View file content
cat file1view the contents of a file starting from the first row
tac file1view the contents of a file starting from the last line
more file1view content of a file along
less file1similar to 'more' command but which allows backward movement in the file as well as forward movement
head -2 file1view first two lines of a file
tail -2 file1view last two lines of a file
tail -f /var/log/messagesview in real time what is added to a file
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Text Manipulation
cat file1 file2 ... | command <> file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT
cat file1 | command( sed, grep, awk, grep, etc...) > result.txtgeneral syntax to manipulate a text of a file, and write result to a new file
cat file1 | command( sed, grep, awk, grep, etc...) >> result.txtgeneral syntax to manipulate a text of a file and append result in existing file
grep Aug /var/log/messageslook up words "Aug" on file '/var/log/messages'
grep ^Aug /var/log/messageslook up words that begin with "Aug" on file '/var/log/messages'
grep [0-9] /var/log/messagesselect from file '/var/log/messages' all lines that contain numbers
grep Aug -R /var/log/*search string "Aug" at directory '/var/log' and below
sed 's/stringa1/stringa2/g' example.txtreplace "string1" with "string2" in example.txt
sed '/^$/d' example.txtremove all blank lines from example.txt
sed '/ *#/d; /^$/d' example.txtremove comments and blank lines from example.txt
echo 'esempio' | tr '[:lower:]' '[:upper:]'convert from lower case in upper case
sed -e '1d' result.txteliminates the first line from file example.txt
sed -n '/stringa1/p'view only lines that contain the word "string1"
sed -e 's/ *$//' example.txtremove empty characters at the end of each row
sed -e 's/stringa1//g' example.txtremove only the word "string1" from text and leave intact all
sed -n '1,5p;5q' example.txtview from 1th to 5th row
sed -n '5p;5q' example.txtview row number 5
sed -e 's/00*/0/g' example.txtreplace more zeros with a single zero
cat -n file1number row of a file
cat example.txt | awk 'NR%2==1'remove all even lines from example.txt
echo a b c | awk '{print $1}'view the first column of a line
echo a b c | awk '{print $1,$3}'view the first and third column of a line
paste file1 file2merging contents of two files for columns
paste  -d  '+' file1 file2merging contents of two files for columns with '+' delimiter on the center
sort file1 file2sort contents of two files
sort file1 file2 | uniqsort contents of two files omitting lines repeated
sort file1 file2 | uniq -usort contents of two files by viewing only unique line
sort file1 file2 | uniq -dsort contents of two files by viewing only duplicate line
comm -1 file1 file2compare contents of two files by deleting only unique lines from 'file1'
comm -2 file1 file2compare contents of two files by deleting only unique lines from 'file2'
comm -3 file1 file2compare contents of two files by deleting only the lines that appear on both files
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Character set and Format file conversion
dos2unix filedos.txt fileunix.txtconvert a text file format from MSDOS to UNIX
unix2dos fileunix.txt filedos.txtconvert a text file format from UNIX to MSDOS
recode ..HTML < page.txt > page.htmlconvert a text file to html
recode -l | moreshow all available formats conversion
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Filesystem Analysis
badblocks  -v  /dev/hda1check bad blocks in disk hda1
fsck  /dev/hda1repair / check integrity of linux filesystem on disk hda1
fsck.ext2  /dev/hda1repair / check integrity of ext2 filesystem on disk hda1
e2fsck  /dev/hda1repair / check integrity of ext2 filesystem on disk hda1
e2fsck -j /dev/hda1repair / check integrity of ext3 filesystem on disk hda1
fsck.ext3  /dev/hda1repair / check integrity of ext3 filesystem on disk hda1
fsck.vfat  /dev/hda1repair / check integrity of fat filesystem on disk hda1
fsck.msdos  /dev/hda1repair / check integrity of dos filesystem on disk hda1
dosfsck  /dev/hda1repair / check integrity of dos filesystems on disk hda1
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Format a Filesystem
mkfs /dev/hda1create a filesystem type linux on hda1 partition
mke2fs /dev/hda1create a filesystem type linux ext2 on hda1 partition
mke2fs -j /dev/hda1create a filesystem type linux ext3 (journal) on hda1 partition
mkfs -t vfat 32 -F /dev/hda1create a FAT32 filesystem
fdformat  -n /dev/fd0format a floppy disk
mkswap /dev/hda3create a swap filesystem
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
SWAP filesystem
mkswap /dev/hda3create a swap filesystem
swapon /dev/hda3activating a new swap partition
swapon /dev/hda2 /dev/hdb3 activate two swap partitions
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Backup
dump -0aj -f /tmp/home0.bak /home make a full backup of directory '/home'
dump -1aj -f /tmp/home0.bak /home make a incremental backup of directory '/home'
restore -if /tmp/home0.bakrestoring a backup interactively
rsync -rogpav --delete /home /tmpsynchronization between directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync via SSH tunnel
rsync -az -e ssh --delete ip_addr:/home/public /home/localsynchronize a local directory with a remote directory via ssh and compression
rsync -az -e ssh --delete /home/local ip_addr:/home/publicsynchronize a remote directory with a local directory via ssh and compression
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
dd if=/dev/sda of=/tmp/file1backup content of the harddrive to a file
tar -Puf backup.tar /home/usermake a incremental backup of directory '/home/user'
( 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
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' copy a local directory on remote directory via ssh
tar cf - . | (cd /tmp/backup ; tar xf - )local copy preserving permits and links from a directory to another
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parentsfind and copy all files with '.txt' extention from a directory to another
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2find all files with '.log' extention and make an bzip archive
dd if=/dev/hda of=/dev/fd0 bs=512 count=1make a copy of MBR (Master Boot Record) to floppy
dd if=/dev/fd0 of=/dev/hda bs=512 count=1restore MBR from backup copy saved to floppy
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
CDROM
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -forceclean a rewritable cdrom
mkisofs /dev/cdrom > cd.isocreate an iso p_w_picpath of cdrom on disk
mkisofs /dev/cdrom | gzip > cd_iso.gzcreate a compressed iso p_w_picpath of cdrom on disk
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cdcreate an iso p_w_picpath of a directory
cdrecord -v dev=/dev/cdrom cd.isoburn an ISO p_w_picpath
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom -burn a compressed ISO p_w_picpath
mount -o loop cd.iso /mnt/isomount an ISO p_w_picpath
cd-paranoia -Brip audio tracks from a CD to wav files
cd-paranoia -- "-3"rip first three audio tracks from a CD to wav files
cdrecord --scanbusscan bus to identify the channel scsi
dd if=/dev/hdc | md5sumperform an md5sum on a device, like a CD
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Networking (LAN and WiFi)
ifconfig eth0show configuration of an ethernet network card
ifup eth0activate an interface 'eth0'
ifdown eth0disable an interface 'eth0'
ifconfig eth0 192.168.1.1 netmask 255.255.255.0configure IP Address
ifconfig eth0 promiscconfigure 'eth0' in promiscuous mode to gather packets (sniffing)
dhclient eth0active interface 'eth0' in dhcp mode
route -nshow routing table
route add -net 0/0 gw IP_Gatewayconfigura default gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1configure static route to reach network '192.168.0.0/16'
route del 0/0 gw IP_gatewayremove static route
echo "1" > /proc/sys/net/ipv4/ip_forwardactivate ip routing
hostnameshow hostname of system
host [url]www.example.com[/url]lookup hostname to resolve name to ip address and viceversa(1)
nslookup [url]www.example.com[/url] lookup hostname to resolve name to ip address and viceversa(2)
ip link showshow link status of all interfaces
mii-tool eth0show link status of 'eth0'
ethtool eth0show statistics of network card 'eth0'
netstat -tupshow all active network connections and their PID
netstat -tuplshow all network services listening on the system and their PID
tcpdump tcp port 80show all HTTP traffic
iwlist scanshow wireless networks
iwconfig eth1show configuration of a wireless network card
hostnameshow hostname
host [url]www.example.com[/url] lookup hostname to resolve name to ip address and viceversa
nslookup [url]www.example.com[/url] lookup hostname to resolve name to ip address and viceversa
whois [url]www.example.com[/url] lookup on Whois database
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Microsoft Windows networks (SAMBA)
nbtscan ip_addrnetbios name resolution
nmblookup -A ip_addrnetbios name resolution
smbclient -L ip_addr/hostnameshow remote shares of a windows host
smbget -Rr smb://ip_addr/sharelike wget can download files from a host windows via smb
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/sharemount a windows network share
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
IPTABLES (firewall)
iptables -t filter -Lshow all chains of filtering table
iptables -t nat -Lshow all chains of nat table
iptables -t filter -Fclear all rules from filtering table
iptables -t nat -Fclear all rules from table nat
iptables -t filter -Xdelete any chains created by user
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPTallow telnet connections to input
iptables -t filter -A OUTPUT -p tcp --dport http -j DROPblock HTTP connections to output
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPTallow POP3 connections to forward chain
iptables -t filter -A INPUT -j LOG --log-prefix "DROP INPUT"logging sulla chain di input  Logging on chain input
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEconfigure a PAT (Port Address Traslation) on eth0 masking outbound packets
iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22redirect packets addressed to a host to another host
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Monitoring and debugging
topdisplay linux tasks using most cpu
ps -eafwdisplays linux tasks
ps -e -o pid,args --forestdisplays linux tasks in a hierarchical mode
pstree mostra un albero dei processi sistema Shows a tree system processes
kill -9 ID_Processoforce closure of the process and finish it
kill -1 ID_Processoforce a process to reload configuration
lsof -p $$display a list of files opened by processes
lsof /home/user1displays a list of open files in a given path system
strace -c ls >/dev/nulldisplay system calls made and received by a process
strace -f -e open ls >/dev/nulldisplay library calls
watch -n1 'cat /proc/interrupts'display interrupts in real-time
last rebootshow history reboot
lsmoddisplay kernel loaded
free -mdisplays status of RAM in megabytes
smartctl -A /dev/hdamonitoring reliability of a hard-disk through SMART
smartctl -i /dev/hdacheck if SMART is active on a hard-disk
tail /var/log/dmesgshow events inherent to the process of booting kernel
tail /var/log/messagesshow system events
linux commands line list v1.2 - LinuxGuide.it
GO TOP INDEX ^
Others useful commands
apropos ...keyworddisplay 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 ping display the on-line manual pages for example on ping command - use '-k' option to find any related commands
whatis ...keyword displays description of what a program does
mkbootdisk --device /dev/fd0 `uname -r`create a boot floppy
gpg -c file1encrypt a file with GNU Privacy Guard
gpg file1.gpgdecrypt a file with GNU Privacy Guard
wget -r [url]www.example.com[/url]download an entire web site
wget -c [url]www.example.com/file.iso[/url]download a file with the ability to stop the download and resume later
echo 'wget -c [url]www.example.com/files.iso[/url]' | at 09:00start a download at any given time
ldd /usr/bin/ssh show shared libraries required by ssh program
alias hh='history'set an alias for a command - hh = history
chshchange shell command
chsh --list-shellsnice command to know if you have to remote into another box
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
linux commands line list v1.2 - LinuxGuide.it