Tips: More than 400 commands for GNU / Linux that you should know: D

I have found myself in the GUTL Wiki this complete list with more than 400 commands to GNU / Linux with their respective explanation, and I want to share them with you to complement this excellent article that my colleague wrote to learn how to live with the console.

System information

  1. arch: show the architecture of the machine (1).
  2. join me -m: show the architecture of the machine (2).
  3. uname -r: show the version of the kernel used.
  4. dmidecode -q: show the components (hardware) of the system.
  5. hdparm -i / dev / hda: show the characteristics of a hard disk.
  6. hdparm -tT / dev / sda: perform read test on a hard disk.
  7. cat / proc / cpuinfo: show CPU information.
  8. cat / proc / interrupts: show interruptions.
  9. cat / proc / meminfo: check memory usage.
  10. cat / proc / swaps: show swap files.
  11. cat / proc / version: show the kernel version.
  12. cat / proc / net / dev: show network adapters and statistics.
  13. cat / proc / mounts: show mounted filesystem.
  14. lspci-tv: show PCI devices.
  15. lsusb -tv: show USB devices.
  16. data: show the system date.
  17. 2011 cal: show the 2011 almanac.
  18. 07 cal 2011: show the almanac for the month July 2011.
  19. dates 041217002011.00: set (declare, set) date and time.
  20. clock -w: save date changes in BIOS.

Shutdown (Reboot System or Log Out)

  1. shutdown-h now: turn off the system (1).
  2. init 0: turn off the system (2).
  3. telinit 0: turn off the system (3).
  4. halt: turn off the system (4).
  5. shutdown -h hours: minutes &- Planned system shutdown.
  6. shutdown -c- Cancel a scheduled system shutdown.
  7. shutdown -r now: restart (1).
  8. reboot: restart (2).
  9. logout: Sign off.

Files and Directories

  1. cd / home: enter the "home" directory.
  2. Cd ..: go back one level.
  3. cd ../ ..: go back 2 levels.
  4. CD: go to root directory.
  5. cd ~ user1: go to the user1 directory.
  6. cd -: go (return) to the previous directory.
  7. pwd: show the path of the working directory.
  8. ls: view the files in a directory.
  9. ls -F: view the files in a directory.
  10. Ls -l: show the details of files and folders in a directory.
  11. ls -a: show hidden files.
  12. ls * [0-9]*: show files and folders containing numbers.
  13. tree: show files and folders as a tree starting from the root. (1)
  14. lstree: show files and folders as a tree starting from the root. (2)
  15. mkdir dir1: create a folder or directory named 'dir1'.
  16. mkdir dir1 dir2: create two folders or directories simultaneously (Create two directories at the same time).
  17. mkdir -p / tmp / dir1 / dir2: create a directory tree.
  18. rm -f file1: delete the file named 'file1'.
  19. rmdir dir1: delete the folder named 'dir1'.
  20. rm -rf dir1: delete a folder named 'dir1' with its contents recursively. (If I delete it recursively I am saying that it is with its content).
  21. rm -rf dir1 dir2: delete two folders (directories) with their content recursively.
  22. mv dir1 new_dir: rename or move a file or folder (directory).
  23. zip file1: copy a file.
  24. cp file1 file2: copy two files in unison.
  25. cp dir / *.: copy all files from a directory into the current working directory.
  26. cp -a / tmp / dir1.: copy a directory within the current working directory.
  27. cp -a dir1: copy a directory.
  28. cp -a dir1 dir2: copy two directories in unison.
  29. ln -s file1 LNK1: create a symbolic link to the file or directory.
  30. ln file1 lnk1: create a physical link to the file or directory.
  31. touch -t 0712250000 file1: modify the real time (creation time) of a file or directory.
  32. file file1: output (dump on screen) of the mime type of a text file.
  33. iconv -l: lists of known ciphers.
  34. iconv -f fromEncoding -t toEncoding inputFile> outputFile: create a new form of the input file assuming it is encoded in fromEncoding and converting it to ToEncoding.
  35. find. -maxdepth 1 -name * .jpg -print -exec convert ”{}” -resize 80 × 60 “thumbs / {}” \;: group resized files in the current directory and send them to directories in thumbnail views (requires converting from ImagemagicK).

Find files

  1. find / -name file1: search for file and directory starting from the root of the system.
  2. find / -user user1: search for files and directories belonging to user 'user1'.
  3. find / home / user1 -name \ *. bin: search for files with extension '. bin 'inside the directory' / home / user1 '.
  4. find / usr / bin -type f -atime +100: find binary files not used in the last 100 days.
  5. find / usr / bin -type f -mtime -10: search for files created or changed within the last 10 days.
  6. find / -name \ *. rpm -exec chmod 755 '{}' \;: search for files with '.rpm' extension and modify permissions.
  7. find / -xdev -name \ *. rpm: Search for files with '.rpm' extension ignoring removable devices such as cdrom, pen-drive, etc. ...
  8. locate \ *. ps: find files with extension '.ps' first executed with command 'updatedb'.
  9. where's halt: show the location of a binary, help or source file. In this case it asks where the 'halt' command is.
  10. which halt: show the full path (the entire path) to a binary / executable.

Mounting a filesystem

  1. mount / dev / hda2 / mnt / hda2: mount a disk named hda2. Check first the existence of the directory '/ mnt / hda2'; if it is not, you must create it.
  2. umount / dev / hda2: unmount a disk named hda2. First exit from point '/ mnt / hda2.
  3. fuser -km / mnt / hda2- Force unmount when device is busy.
  4. umount -n / mnt / hda2: run the unmount without reading the / etc / mtab. Useful when the file is read-only or the hard drive is full.
  5. mount / dev / fd0 / mnt / floppy: mount a floppy disk.
  6. mount / dev / cdrom / mnt / cdrom: mount a cdrom / dvdrom.
  7. mount / dev / hdc / mnt / cdrecorder: mount a rewritable cd or dvdrom.
  8. mount / dev / hdb / mnt / cdrecorder: mount a rewritable cd / dvdrom (a dvd).
  9. mount -o loop file.iso / mnt / cdrom: mount a file or iso image.
  10. mount -t vfat / dev / hda5 / mnt / hda5: mount a FAT32 filesystem.
  11. mount / dev / sda1 / mnt / usbdisk: mount a usb pen-drive or memory (without specifying the type of filesystem).
Related article:
4 commands to know data from our HDD or partitions

Disk space

  1. df -h: display a list of mounted partitions.
  2. ls -lSr | more: show the size of the files and directories ordered by size.
  3. du -sh dir1: Estimate the space used by the directory 'dir1'.
  4. du sk * | sort -rn: show the size of the files and directories ordered by size.
  5. rpm -q -a –qf '% 10 {SIZE} t% {NAME} n' | sort -k1,1n: show the space used by the installed rpm packages organized by size (Fedora, Redhat and others).
  6. dpkg-query -W -f = '$ {Installed-Size; 10} t $ {Package} n' | sort -k1,1n: show the space used by installed packages, organized by size (Ubuntu, Debian and others).

Users and Groups

  1. groupadd group_name: create a new group.
  2. groupdel group_name: delete a group.
  3. groupmod -n new_group_name old_group_name: rename a group.
  4. useradd -c “Name Surname” -g admin -d / home / user1 -s / bin / bash user1: Create a new user belonging to the group "admin".
  5. user add user1: create a new user.
  6. userdel -r user1: delete a user ('-r' removes the Home directory).
  7. usermod -c "User FTP”-G system -d / ftp / user1 -s / bin / nologin user1: change user attributes.
  8. Passwd: change Password.
  9. password user1: change a user's password (root only).
  10. chage -E 2011-12-31 user1: set a term for the user's password. In this case it says that the key expires on December 31, 2011.
  11. pwck: check the correct syntax the file format of '/ etc / passwd' and the existence of users.
  12. grpck: check the correct syntax and format of the file '/ etc / group' and the existence of groups.
  13. newgrp group_name: Register a new group to change the default group of newly created files.

Permissions in Files (Use "+" to place permissions and "-" to remove)

  1. ls -lh: Show permissions.
  2. ls / tmp | pr -T5 -W $ COLUMNS: divide the terminal into 5 columns.
  3. chmod ugo + rwx directory1: place read ®, write (w) and execute (x) permissions to owner (u), group (g) and others (o) on directory 'directory1'.
  4. chmod go-rwx directory1: remove read permission ®, write (w) and (x) execute to group (g) and others (o) on directory 'directory1'.
  5. chown user1 file1: change the owner of a file.
  6. chown -R user1 directory1: change the owner of a directory and of all files and directories contained within.
  7. chgrp group1 file1: change group of files.
  8. chown user1: group1 file1: change user and group that owns a file.
  9. find / -perm -u + s: view all files on the system with SUID configured.
  10. chmod u + s / bin / file1: put the SUID bit in a binary file. The user running that file acquires the same privileges as the owner.
  11. chmod us / bin / file1: disable the SUID bit in a binary file.
  12. chmod g + s / home / public: put an SGID bit in a directory –similar to SUID but per directory.
  13. chmod gs / home / public: disable an SGID bit in a directory.
  14. chmod o + t / home / public: put a STIKY bit in a directory. Allows file deletion only to legitimate owners.
  15. chmod ot / home / public: disable a STIKY bit in a directory.

Special attributes in files (Use "+" to set permissions and "-" to remove)

  1. chattr + to file1: allows writing by opening a file only append mode.
  2. chattr + c file1: allows a file to be compressed / decompressed automatically.
  3. chattr + d file1: ensures that the program ignores deleting files during backup.
  4. chattr + i file1: makes the file invariable, so it cannot be deleted, altered, renamed, or linked.
  5. chattr + s file1: allows a file to be safely deleted.
  6. chattr + S file1: ensures that a file is modified, changes are written in synchronous mode as with sync.
  7. chattr + u file1: allows you to recover the content of a file even if it is canceled.
  8. lsattr: show special attributes.
Related article:
With Terminal: Size and Space Commands

Archives and compressed files

  1. bunzip2 file1.bz2: unzip a file named 'file1.bz2'.
  2. bzip2 file1: compress a file named 'file1'.
  3. Gunzip File1.gz: unzip a file called 'file1.gz'.
  4. gzip file1: compress a file named 'file1'.
  5. gzip -9 file1: compresses with maximum compression.
  6. rar to file1.rar test_file: create a rar file called 'file1.rar'.
  7. rar to file1.rar file1 file2 dir1: compress 'file1', 'file2' and 'dir1' simultaneously.
  8. rar x file1.rar: unzip rar file.
  9. UNRAR X FILE1.RAR: unzip rar file.
  10. tar -cvf archive.tar file1: create an unzipped tarball.
  11. tar -cvf archive.tar file1 file2 dir1: create a file containing 'file1', 'file2' and 'dir1'.
  12. tar tf archive.tar: display the contents of a file.
  13. tar -xvf archive.tar: extract a tarball.
  14. tar -xvf archive.tar -C / tmp: extract a tarball in / tmp.
  15. tar -cvfj archive.tar.bz2 dir1: create a compressed tarball inside bzip2.
  16. -xvfj tar archive.tar.bz2: decompress a tar archive compressed in bzip2
  17. tar -cvfz archive.tar.gz dir1: create a gzipped tarball.
  18. tar -xvfz archive.tar.gz- Unzip a gzipped tar archive.
  19. zip file1: create a compressed zip file.
  20. zip -r file1 file2 dir1: compress, in zip, several files and directories simultaneously.
  21. unzip unzip a zip file.

RPM packages (Red Hat, Fedora, and the like)

  1. rpm ivh package.rpm: install an rpm package.
  2. rpm -ivh –nodeeps package.rpm: install an rpm package ignoring dependency requests.
  3. rpm -U package.rpm: update a rpm package without changing the configuration of the files.
  4. rpm -F package.rpm: update an rpm package only if it is installed.
  5. rpm -e package_name.rpm: remove a rpm package.
  6. rpm -qa: show all rpm packages installed on the system.
  7. rpm -qa | grep httpd: show all rpm packages with the name "httpd".
  8. rpm -qi package_name- Get information on a specific installed package.
  9. rpm -qg "System Environment / Daemons": show rpm packages of a software group.
  10. rpm -ql package_name: show list of files given by an installed rpm package.
  11. rpm -qc package_name: show configuration list of files given by an installed rpm package.
  12. rpm -q package_name --whatrequires: show requested list of dependencies for an rpm package.
  13. rpm -q package_name -whatprovides: show the capacity given by an rpm package.
  14. rpm -q package_name --scripts: show scripts started during installation / removal.
  15. rpm -q package_name --changelog: show the revision history of an rpm package.
  16. rpm -qf /etc/httpd/conf/httpd.conf: check which rpm package belongs to a given file.
  17. rpm -qp package.rpm -l: show list of files given by a rpm package that has not yet been installed.
  18. rpm –import / media / cdrom / RPM-GPG-KEY: import the digital signature of the public key.
  19. rpm –checksig package.rpm: verify the integrity of an rpm package.
  20. RPM -QA GPG -Pubkey- Check the integrity of all installed rpm packages.
  21. rpm -V package_name: check file size, licenses, types, owner, group, MD5 summary check and last modification.
  22. rpm -Va: check all rpm packages installed on the system. Use with care.
  23. Vp rpm package.rpm: check an rpm package not installed yet.
  24. rpm2cpio package.rpm | cpio –extract –make-directories * bin*: extract executable file from rpm package.
  25. rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm: install a package built from an rpm source.
  26. rpmbuild –rebuild package_name.src.rpm: build a rpm package from a rpm source.

YUM Package Updater (Red Hat, Fedora and the like)

  1. yum install package_name: download and install an rpm package.
  2. yum localinstall package_name.rpm: this will install an RPM and try to resolve all dependencies for you, using your repositories.
  3. yum update package_name.rpm: update all rpm packages installed on the system.
  4. yum update package_name: modernize / update an rpm package.
  5. yum remove package_name: remove a rpm package.
  6. yum list: list all packages installed on the system.
  7. yum search package_name: Find a package in rpm repository.
  8. yum clean packages: clear an rpm cache by deleting downloaded packages.
  9. yum clean headers: remove all header files that the system uses to resolve the dependency.
  10. yum clean all: remove from cache packets and header files.

Deb packages (Debian, Ubuntu and derivatives)

  1. dpkg -i package.deb: install / update a deb package.
  2. dpkg -r package_name: remove a deb package from the system.
  3. dpkg -l: show all deb packages installed on the system.
  4. dpkg -l | grep httpd: show all deb packages with the name "httpd"
  5. dpkg -s package_name- Get information on a specific package installed on the system.
  6. dpkg -L package_name: show list of files given by a package installed on the system.
  7. dpkg -contents package.deb: show list of files given by a package not installed yet.
  8. dpkg -S / bin / ping: check which package belongs to a given file.

APT Package Updater (Debian, Ubuntu and derivatives)

  1. apt-get install package_name: install / update a deb package.
  2. apt-cdrom install package_name: install / update a deb package from a cdrom.
  3. apt-get update: update package list.
  4. apt-get upgrade: update all installed packages.
  5. apt-get remove package_name: remove a deb package from the system.
  6. apt get check: verify the correct resolution of the dependencies.
  7. apt-get clean: clear cache from downloaded packages.
  8. apt-cache search searched-package: returns a list of packages corresponding to the series "searched packages".

View the content of a file

  1. cat file1: view the contents of a file starting from the first row.
  2. tock file1: view the contents of a file starting from the last line.
  3. more file1: view the content throughout a file.
  4. less file1: similar to the 'more' command but allows saving the movement in the file as well as the movement backwards.
  5. head -2 file1: see the first two lines of a file.
  6. tail -2 file1: see the last two lines of a file.
  7. tail -f / var / log / messages: see in real time what has been added to the file.

Text manipulation

  1. cat file1 file2 .. | command <> file1_in.txt_or_file1_out.txt- General syntax for manipulating text using PIPE, STDIN, and STDOUT.
  2. cat file1 | command (sed, grep, awk, grep, etc ...)> result.txt: general syntax to manipulate a text in a file and write the result in a new file.
  3. cat file1 | command (sed, grep, awk, grep, etc ...) »result.txt: general syntax to manipulate a text in a file and add results to an existing file.
  4. grep Aug / var / log / messages: search for words “Aug” in the file '/ var / log / messages'.
  5. grep ^ Aug / var / log / messages: find words starting with “Aug” in file '/ var / log / messages'
  6. grep [0-9] / var / log / messages: select all lines in the file '/ var / log / messages' that contain numbers.
  7. grep Aug -R / var / log /*: look for the string “Aug” in the directory '/ var / log' and below.
  8. sed 's / stringa1 / stringa2 / g' example.txt: relocate "string1" with "string2" in example.txt
  9. sed '/ ^ $ / d' example.txt: remove all blank lines from example.txt
  10. sed '/ * # / d; / ^ $ / d 'example.txt: remove comments and blank lines from example.txt
  11. echo 'esempio' | tr '[: lower:]' '[: upper:]': convert lowercase to uppercase.
  12. sed -e '1d' result.txt: remove the first line of the file example.txt
  13. sed -n '/ stringa1 / p': display only the lines that contain the word "string1".

Set character and file conversion

  1. dos2unix filedos.txt fileunix.txt: convert a text file format from MSDOS to UNIX.
  2. unix2dos fileunix.txt filedos.txt: convert a text file format from UNIX to MSDOS.
  3. recode ..HTML <page.txt> page.html: convert a text file into html.
  4. recode -l | more- Show all available format conversions.

File system analysis

  1. badblocks -v / dev / hda1: Check bad blocks on disk hda1.
  2. fsck / dev / hda1: repair / check the integrity of the Linux system file on disk hda1.
  3. fsck.ext2 / dev / hda1: repair / check integrity of ext 2 system file on disk hda1.
  4. e2fsck / dev / hda1: repair / check integrity of ext 2 system file on disk hda1.
  5. e2fsck -j / dev / hda1: repair / check integrity of ext 3 system file on disk hda1.
  6. fsck.ext3 / dev / hda1: repair / check integrity of ext 3 system file on disk hda1.
  7. fsck.vfat / dev / hda1: repair / check the integrity of the fat system file on disk hda1.
  8. fsck.msdos / dev / hda1: repair / check the integrity of a file on system dos on disk hda1.
  9. dosfsck / dev / hda1: repair / check the integrity of a file on system dos on disk hda1.

Format a filesystem

  1. mkfs / dev / hda1: create a Linux-like system file on partition hda1.
  2. mke2fs / dev / hda1: create a Linux ext 2 system file on hda1.
  3. mke2fs -j / dev / hda1: create a Linux ext3 (periodic) system file on partition hda1.
  4. mkfs -t vfat 32 -F / dev / hda1: create a FAT32 system file on hda1.
  5. fdformat -n / dev / fd0: format a flooply disk.
  6. mkswap / dev / hda3: create a swap system file.

I work with the SWAP

  1. mkswap / dev / hda3: create swap system file.
  2. swapon / dev / hda3: activating a new swap partition.
  3. swapon / dev / hda2 / dev / hdb3: activate two swap partitions.

Saves (Backup)

  1. dump -0aj -f /tmp/home0.bak / home: make a full save of the '/ home' directory.
  2. dump -1aj -f /tmp/home0.bak / home: make an incremental save of the '/ home' directory.
  3. restore -if /tmp/home0.bak: restoring a salvo interactively.
  4. rsync -rogpav –delete / home / tmp: synchronization between directories.
  5. rsync -rogpav -e ssh –delete / home ip_address: / tmp: rsync through tunnel SSH.
  6. rsync -az -e ssh –delete ip_addr: / home / public / home / local- Synchronize a local directory with a remote directory via ssh and compression.
  7. rsync -az -e ssh –delete / home / local ip_addr: / home / public- Synchronize a remote directory with a local directory via ssh and compression.
  8. dd bs = 1M if = / dev / hda | gzip | ssh user @ ip_addr 'dd of = hda.gz': save a hard drive on a remote host via ssh.
  9. dd if = / dev / sda of = / tmp / file1: save the contents of a hard disk to a file. (In this case the hard disk is "sda" and the file is "file1").
  10. tar -Puf backup.tar / home / user: make an incremental save of the directory '/ home / user'.
  11. (cd / tmp / local / && tar c.) | ssh -C user @ ip_addr 'cd / home / share / && tar x -p': copy the contents of a directory to a remote directory via ssh.
  12. (tar c / home) | ssh -C user @ ip_addr 'cd / home / backup-home && tar x -p': copy a local directory to a remote directory via ssh.
  13. tar cf -. | (cd / tmp / backup; tar xf -): local copy preserving licenses and links from one directory to another.
  14. find / home / user1 -name '* .txt' | xargs cp -av –target-directory = / home / backup / –parents: find and copy all files with extension '.txt' from one directory to another.
  15. find / var / log -name '* .log' | tar cv –files-from = - | bzip2> log.tar.bz2: find all files with the extension '.log' and make a bzip archive.
  16. dd if = / dev / hda of = / dev / fd0 bs = 512 count = 1: make a copy of the MRB (Master Boot Record) to a floppy disk.
  17. dd if = / dev / fd0 of = / dev / hda bs = 512 count = 1: restore the copy of the MBR (Master Boot Record) saved on a floppy.


  1. cdrecord -v gracetime = 2 dev = / dev / cdrom -eject blank = fast -force: clean or erase a rewritable cd.
  2. mkisofs / dev / cdrom> cd.iso: create an iso image of cdrom on disk.
  3. mkisofs / dev / cdrom | gzip> cd_iso.gz: create a compressed iso image of cdrom on disk.
  4. mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd: create an iso image of a directory.
  5. cdrecord -v dev = / dev / cdrom cd.iso: burn an iso image.
  6. gzip -dc cd_iso.gz | cdrecord dev = / dev / cdrom -: burn a compressed iso image.
  7. mount -o loop cd.iso / mnt / iso: mount an iso image.
  8. cd-paranoia -B: take songs from a cd to wav files.
  9. cd-paranoia - "-3": transfer the first 3 songs from a cd to wav files.
  10. Cdrecord –Scanbus: scan bus to identify scsi channel.
  11. dd if = / dev / hdc | md5sum: run an md5sum on a device, such as a CD.

I work with the NETWORK ( LAN and Wi-Fi)

  1. ifconfig eth0: show the configuration of an Ethernet network card.
  2. ifup eth0: activate an interface 'eth0'.
  3. ifdown eth0: disable an interface 'eth0'.
  4. ifconfig eth0 netmask configure an IP address.
  5. ifconfig eth0 promisc: configure 'eth0' in common mode to obtain packets (sniffing).
  6. dhclient eth0: activate interface 'eth0' in dhcp mode.
  7. route: show tour table.
  8. route add -net 0/0 gw IP_Gateway: set default input.
  9. route add -net netmask gw configure static route to search the network ''.
  10. route del 0/0 gw IP_gateway: remove the static route.
  11. echo "1"> / proc / sys / net / ipv4 / ip_forward: activate ip tour.
  12. hostname: display the hostname of the system.
  13. host find the host name to resolve the name to an ip address (1).
  14. nslookup find the host name to resolve the name to an ip address and vice versa (2).
  15. ip link show: show link status of all interfaces.
  16. mii-tool eth0: show link status of 'eth0'.
  17. ethtool eth0: show the statistics of network card 'eth0'.
  18. netstat-tup- Show all active network connections and their PIDs.
  19. netstat-tupl: show all network listeners on the system and their PIDs.
  20. tcp dump tcp port 80: show all traffic HTTP.
  21. iwlist scan: show wireless networks.
  22. iwconfig eth1: show the configuration of a wireless network card.
  23. whois search the Whois database.

Microsoft Windows Networks (SAMBA)

  1. nbtscan ip_addr: bios network name resolution.
  2. nmblookup -A ip_addr: bios network name resolution.
  3. smbclient -L ip_addr / hostname: show remote actions of a host in windows.


  1. iptables -t filter -L: show all strings in the filter table.
  2. iptables -t nat -L: show all strings from nat table.
  3. iptables -t filter -F: clear all rules from filter table.
  4. iptables -t nat -F: clear all rules from nat table.
  5. iptables -t filter -X: delete any string created by the user.
  6. iptables -t filter -A INPUT -p tcp telnet -j ACCEPT -dport: allow telnet connections to enter.
  7. iptables -t filter -A OUTPUT -p tcp -dport http -j DROP: block connections HTTP to go out.
  8. iptables -t filter -A FORWARD -p tcp –dport pop3 -j ACCEPT: allow connections POP to a front chain.
  9. iptables -t filter -A INPUT -j LOG --log-prefix “DROP INPUT”: registering an input string.
  10. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE: configure a PAT (Address Translation Port) on eth0, hiding the force-out packets.
  11. iptables -t nat -A PREROUTING -d -p tcp -m tcp –dport 22 -j DNAT –to-destination redirect packets directed from one host to another.

Monitoring and debugging

  1. top: show linux tasks using most cpu.
  2. ps-eafw: shows Linux tasks.
  3. ps -e -o pid, args –forest- Displays Linux tasks in a hierarchical mode.
  4. ptree: show a process system tree.
  5. kill -9 Process_ID- Force close a process and terminate it.
  6. kill -1 Process_ID: force a process to reload the configuration.
  7. lsof -p $$: show a list of files opened by processes.
  8. lsof / home / user1: shows a list of open files in a given path of the system.
  9. strace -c ls> / dev / null: show the system calls made and received by a process.
  10. strace -f -e open ls> / dev / null: show the calls to the library.
  11. watch -n1 'cat / proc / interrupts': show interruptions in real time.
  12. last reboot: show reboot history.
  13. lsmod: show the loaded kernel.
  14. free -m- Displays the status of RAM in megabytes.
  15. smartctl -A / dev / hda- Monitor the reliability of a hard drive through SMART.
  16. smartctl -i / dev / hda: check if SMART is enabled on a hard disk.
  17. tail / var / log / dmesg: show events inherent to the kernel loading process.
  18. tail / var / log / messages: show system events.

Other useful commands

  1. apropos ... keyword: show a list of commands that belong to the keywords of a program; They are useful when you know what your program does, but you do not know the name of the command.
  2. manping: show the manual pages online; for example, in a ping command, use the '-k' option to find any related command.
  3. whatis… keyword: shows the description of what the program does.
  4. mkbootdisk –device / dev / fd0 `uname -r`: create a potable floppy.
  5. gpg -c file1: encode a file with GNU security guard.
  6. gpg file1.gpg: decode a file with GNU Security Guard.
  7. wget -r download a complete website.
  8. wget -c download a file with the possibility of stopping the download and resuming later.
  9. echo 'wget -c'| at 09:00: Start a download at any time. In this case it would start at 9 o'clock.
  10. ldd / usr / bin / ssh: show the shared libraries required by the ssh program.
  11. alias hh = 'history': place an alias for a command –hh = History.
  12. chsh: change the Shell command.
  13. chsh --list-shells: is a suitable command to know if you have to do remote in another terminal.
  14. WHO -a: show who is registered, and print time of the last import system, dead processes, system registry processes, active processes produced by init, current operation and last changes of the system clock.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

182 comments, leave yours

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   dbillyx said

    excellent contribution ... thank you ...

  2.   diazepam said

    Direct to favorites as they say.

  3.   Jamin samuel said

    Holy God: Or now is what I need to learn 😀 thank you for this contribution 😉

    1.    ETS said

      It's definitely a lot of commands.
      Nothing is impossible with practice.

  4.   kik1n said

    Thanks for the contribution 😀

  5.   The front said


    1.    Luis Caceres said

      Difficult Linux but the best

  6.   pandev92 said

    Right now I keep them in my huge memory XD

  7.   Mauritius said

    Huge post !! direct to favorites.

  8.   ren434 said

    Thanks for the contribution, I will send it to a friend who is eager to learn. And I'll also keep it for myself of course.

  9.   vicky said

    Wow, direct to favorites, thank you very much.

    One of my favorite console programs is ncdu shows the space occupied by each folder, very good when you want to clean the hard disk a bit. I also really like ranger, a very easy to use file manager.

  10.   Hugo said

    Elav, I have noticed that the numbered lists reset after 9, but this does not happen on the Wiki. Is it intentional, or did you have any difficulty transporting the information?

    By the way, I added some more commands to the list and structured the format of the article on the Wiki a bit.

    1.    elav <° Linux said

      Oops. I hadn't even realized that. Let me check the post's HTML code to see what's up with this. I can't believe WordPress only accepts 9 items in the lists ...

    2.    elav <° Linux said

      This has me fused. With good reason I had not noticed, because in the WordPress editor, the numbering works well. O_O

      1.    Hugo said

        Hmm… in that case the problem is apparently one of styles. Let me see…

        OK, in the file "themes / arr / css / base.css" look for this line:

        .entry-content ul, .entry-content ol { margin: 0 20px; padding: 0 0 1.5em; }

        And modify it so that it looks like this:

        .entry-content ul, .entry-content ol { margin: 0 20px; padding: 0 0 1.5em 0.5em; }

        That should solve the problem (at least for two-digit listings), but obviously I can't give you a guarantee of success.

        1.    elav <° Linux said

          Thank you, friend. Tomorrow I try that 😀

          1.    Hugo said

            No need, hopefully it works.

            Tomorrow I will be at the Univ until around noon, but if you have any problems write me at gmx.

          2.    Hugo said

            Well, could you finally take the test?

            1.    elav <° Linux said

              Not really. Right now I'm going to do it with the Arras that I have local 😀

            2.    elav <° Linux said

              I just tried and it doesn't work 🙁

  11.   kannabix said

    You should see my favorite rosetta stone, I can't live without it:

  12.   rudolph alexander said

    A file at the end with all the commands to download would not be bad, very good post. That speeds up everything 🙂

  13.   Samano said

    Thank you, good contribution

  14.   Keopety said

    Thank you very much, friend, good contribution

  15.   Gabriel said

    Thanks for the input.

  16.   Oscar said

    Some special reason why you didn't include the "aptitude" command. Very good and practical tips, excellent reference material.

    1.    Hugo said

      The creator of the original article on the GUTL Wiki probably did not include this command, considering it redundant in relation to apt-get (my deductions, I have not asked). I also prefer aptitude, I find it more useful. Maybe one of these days I will have time to add some examples with aptitude. My favorite is:

      aptitude -RvW install paquete

      It remains for you to find out what those parameters do, hehe 😉

      1.    Oscar said

        Thanks for the clarification, I also use aptitude, personally I find it more effective, I was curious about the example you gave, I will surely investigate.

  17.   auroszx said

    -Wow! I did not think you were serious OO The truth is there are many commands, I add the post to favorites to read it calmly later ...

  18.   TDE said

    Elav, if this were Taringa I would not hesitate to leave you my ten points 😀
    Excellent post!

    1.    elav <° Linux said

      Thanks TDE although the merit is not mine, I only brought the content of the GUTL Wiki. ^^

  19.   Yoyo Fernandez said

    Impressive, I'll share it wherever I go 🙂

    1.    KZKG ^ Gaara said

      Thank you

  20.   chromaffin said

    awesome post and very very helpful..thanx a lot .. !!!

  21.   mdrvro said

    Thank you. It is an essential material.

  22.   Simon said

    Does anyone know the command to close the Gnome Shell session when gnome-session-quit doesn't work?

    1.    Hugo said

      I don't use Gnome Shell, but try this:

      sudo killall gnome-shell

      Or maybe this other way:

      sudo killall -SIGHUP gnome-shell

    2.    diego said


  23.   phantom said

    remarkable contribution. thanks

  24.   nexus said


  25.   lV said

    sudo echo 3> / proc / sys / vm / drop_caches: clear physical memory.
    or this one:
    sudo sync && sudo sysctl vm.drop_caches = 3: clean up physical memory at runtime.

  26.   ghermain said

    Very good compilation, with your permission I will copy it to share it on my page with your credit.

  27.   Diavolo said

    Here are 'some' more commands to learn =)

  28.   Eugenia bahit said

    How thick Elav !!! As always, a marvel

    1.    elav <° Linux said

      Thank you for stopping by Eugenia 😀

    2.    KZKG ^ Gaara said

      To you 😀

  29.   DiegoRR said

    That's so good!!! I'm going to print it and take it with me. Thanks for the input.

    1.    KZKG ^ Gaara said

      A pleasure to help 🙂

  30.   Jorge Molina (@Georgejamb) said

    Very good!

  31.   Mique_G3 said

    I like it, the article is so interesting, thank you very much

  32.   msx said

    EXCELLENT, thanks for posting it!

  33.   angel said

    Thank you!

  34.   Alrep said

    Great thank you very much!

  35.   maxjedrum said

    Excellent contribution!

    Thank you very much.

  36.   Alex said

    Great, thank you very much, another one more to favorites ...

  37.   Jose Alejandro Vazquez said

    It is the best summary that I have seen of linux commands, Congratulations that excellent contribution!

  38.   Silicon Hosting Team said

    Dear Elav,

    We have taken your article to create an article in our knowledge base, in which of course we have cited you as a source.

    You can review the article at the following link:

    A great contribution, thank you very much.

    1.    elav said

      As long as there is a link to the original article, you can do whatever you want with it. Thanks for notifying. 😉

      1.    Silicon Hosting Team said

        Of course Elav, you can check the link at the end of the article.

        If you wish to take any of our articles, you are completely free to review, reproduce all or part of them.

        Thank you again.

        1.    elav said

          Yes, I already checked it and by the way I was seeing a little about the services they offer, because I did not know them .. Thank you for giving me your articles, which I also reviewed and are quite interesting 😉


  39.   Jeyzee said

    Many thanks! I'm going to print them in case one day I don't have internet!
    Thanks and Salu2

  40.   ayosinho said

    Impressive post, yes sir. And a question, do you know of a book, tutorial or something to learn to use the terminal? I've been using Linux since Ubuntu 9.04 but I know the basics, I'd like to learn more about it. Thanks and best regards.

  41.   PITUCALEYA said


    Is there a way to get that in text format (word, txt, PDF)?

  42.   fernando said

    Thanks for the input.

  43.   anon said

    Wow thanks for the contribution menu 🙂

  44.   Toleko said

    The linux world fascinates me, this material is gold, greetings from Tijuana Mx.
    right now I am re-installing my Linux mint 14, when I re-installed xp the option to choose system before starting was deleted,,,,, greetings again

  45.   pianist said

    We thank you for the compilation very good post ...


  46.   meatball said

    Excellent information

  47.   band-aids said

    Thanks to the editor, this could be converted to pdf. It is for printing. Thank you community.

  48.   zulantay said

    Tremendous contribution, Thank you.
    The page is excellent, by far one of the best on the subject.

    1.    KZKG ^ Gaara said

      Thank you very much for stopping by.

  49.   Luis said

    I want to find the file that occupies the most space

  50.   Dementia said

    Raffled the contribution ...

  51.   Dementia said

    I would like to be able to list the files of each user, and that the one I did only shows me the number of folders and not the ones inside

  52.   daniel c. said

    woowww grandeee .. thanksss !!!

  53.   antonio said

    someone who can answer me the definition of this command rpm -Uvh?
    How can I use it

  54.   patodx said

    Big ELAV …… !!! I had not seen this post ... thank you very much ..

  55.   Armando Sanchez placeholder image said

    It seems to me a good compilation, I will have it at hand.

    Thanks for the input

  56.   Douglas milano said

    I congratulate you, excellent information, very useful.

  57.   Roger ceballos said

    Definitely grax ya favorites goes

  58.   guadahorce said

    Excellent contribution. I was impressed by the effort and the compilation that GTL has made, as well as the presentation and accommodation among others of ELAV.
    I copy them and use them in brebe, to learn a little more.
    Thank you both for your contribution to the Linux community and your generosity.
    A greeting.

  59.   lucasmatias said


  60.   xhunko said

    Excellent, excellent, thank you very much.

  61.   gabriel said

    man what a good post I use it every day since I am starting with this, I thank you for sharing it with us.

  62.   felix said

    I like it a lot but it is a bit difficult for me to learn I do not know anything about Linux I am starting a course in the academy of free software well I hope to learn and thank you for your contributions to this community.

  63.   Mark said

    Hello, everything is very complete, but I can't find how to repair the system startup.
    I use Fedora and after enabling the Gnome desktop it doesn't start unless I enter and type BOOT at the beginning.
    I would like the system to automatically enter the Gnome desktop without my intervention.
    Any command to use or file to edit ??
    Thank you very much!

  64.   Ramon Zambrano said

    Thank excellent contribution

  65.   David Jose Arias said

    Very good information, very useful…. 🙂

  66.   Fabio Vera said

    very good information and very detailed thanks

  67.   Jose David said

    Thanks I did my homework XD

  68.   Fer said

    Thank you just or what was I looking for 😀

    I'm reading a book from windows to linux and I'm spending little time xD

    I hope I can dominate this world 😛

  69.   luzma said

    Direct to favorites, evernote, notes, onenote, print, etc etc so that they are always at hand. Thanks a lot!!

  70.   christianwp said

    Thanks for the input

  71.   Jean hernandez said

    There is a broken link, at least a 404 error appears via smartphone where you link to "this excellent article"

  72.   leo said

    It's very good!

  73.   Freya said

    Frankly very good, thank you very much.

  74.   Full said

    Very good blogger contribution direct to favorites


  75.   Javi said

    Great contribution. Thanks 😀

  76.   ligator said

    Excellent! I'll give you 10 points! 😀

  77.   zayder said

    Very good post I really like

  78.   orion_ad said

    I imagine the time that would have saved me if I had seen this article a few years ago it is very good, thank you very much

  79.   rainerhg said

    And the command poweroff?
    I used it when I started to get to know Linux (using Slax on a USB), for when the environment would freeze and I didn't open any menu or button, then I would turn it off with this command.

  80.   dj everest said

    Wonderful !! This page has already gotten me out of several troubles. Very good work.

  81.   Matias said

    spectacular. Don't you have it in a PDF file or something similar to download it? you don't have the VI editor commands?

  82.   antonio said

    Very good list, thanks for the contribution. I share one that I found out there some time ago.

  83.   Abel Elias Ledo Amachi said

    Very good blog, I was looking for it. Thank you

  84.   Daniel Luque said

    Excellent!!! your contribution to free-software is very good

  85.   mateo said

    thank you it was very helpful

  86.   Juan Carlos said

    Thanks for sharing, excellent IT input

  87.   Omar said

    Really very useful, especially for Linux newbies and old timers. thanks

  88.   Daniel Pérez said

    Excellent contribution

  89.   atila said

    Very good. I just need to try some ribs

  90.   Carlos said

    thank you!

  91.   Paul said

    Thank you!

  92.   Carlos said

    a question as it is called in windows in what system administrator is used as and another
    the commands also work for windows ?? thanksss.

    1.    nogi said

      1-the windows command box is opened by putting «cmd» in the search engine at the beginning
      2- These commands, most of them do not work for windows, there are some that coincide like those of «cd» but I advise you to look for another blog where they speak specifically of commands for windows

  93.   Alexander said

    [CTRL + D]

  94.   claudio said

    Tremendous contribution… thank you… !!! saved ...

  95.   wifi for events said

    Thanks for sharing bookmarking the blog to get in touch for more articles

  96.   Young said

    thanks for the input

  97.   Cristian said

    Friend, thanks for this tremendous contribution, very good contribution, and thank you for sharing it.

  98.   Arthur said

    Everything is very interesting, it's time to practice ..

  99.   you like buy it !! said

    -h This help text.
    –No-gui Do not use the GTK interface even though it is available.
    -s Simulates the actions, but does not actually perform them.
    -d Only downloads packages, does not install or uninstall anything.
    -p Always ask for confirmation of actions.
    -y Assumes that the answer to simple yes / no questions is 'yes'.
    -F format Specifies the format for displaying the results of the
    searches, read the manual.
    -O order Specifies how the search results should be ordered,
    read the manual.
    -w width Specifies the width of the viewer to format the results
    of the search.
    -f Aggressively tries to fix broken packages.
    -V Shows the version of the packages to install.
    -D Show dependencies for automatically changed packages.
    -Z Displays the change of the installed size of each package.
    -v Show extra information (can occur more than once).
    -t [distrib] Sets the distribution from which packages are installed.
    -q Does not show incremental progress indicators
    in command line mode.
    -o opconf = val Directly set the configuration option named "opconf".
    –With (out) -recommends, Specifies whether or not the
    recommendations like strong dependencies.
    -S fname: reads aptitude extended status information from fname.
    -u: Download a new package list on boot.
    (terminal interface only)
    -i: Performs an installation on boot.
    (terminal interface only)

  100.   Fernando said

    Wow, thanks for the contribution, it will really be very useful. Now my problem will be to learn how to use them, xD thanks.

  101.   Jesus SEQUEIROS ARONE said

    Excellent compilation.

  102.   Marian velarde said

    Thanks friend, tremendous contribution! 😀 😀

  103.   ninoshka said

    What is the which command for?

    1.    barnarasta said

      It's like a #locate

      # man which

  104.   Gonzalo said

    Well friend, thank you very much, it is very helpful for those of us who work in this environment

  105.   Nicholas said

    This is exactly what I am looking for 3 days ago!
    Thank you very much, this is priceless 😀

  106.   lllll said

    good contribution, very useful

  107.   Carlos Best said

    Every time I forget commands, I return to this article.
    a greeting


    Thank you very much.
    The manual has been of great use
    Caracas Venezuela

  109.   Alejandro said

    very well explained each command, it is a very good reference if you are a system administrator based on unix

  110.   Tavita Padilla said

    thanks I know I'm going to need you

  111.   David yusti said

    Very helpful thanks

  112.   Marcial Quispe Huaman said

    Greetings, excellent blog, thank you very much for that contribution to the GNU / linux community. Cordially Martial.

  113.   Alex said

    The tremendous contribution is appreciated
    thank you very much
    greetings from Chile

  114.   Armando Leisure said

    very good compilation of commands, quite useful.

  115.   Paulo said

    Thank you for this excellent contribution.

  116.   oneki said

    great thanks for the contribution but I imagine there are millions of command or not

  117.   Paco García said

    3 years later it is still a great contribution for the benefit of all!

    Thank you.

  118.   Philip Cardona said

    Thank you very much, it is a great help for my learning.

  119.   Lola said

    I loved them! This post is great 😀

  120.   eniac said

    Excellent, very good

  121.   Ibersystems said

    complete guide thanks for sharing

  122.   George said

    Hello friends, I am a newbie, the question I want to ask you is if Debian and Ubuntu are fully compatible, what I want to imply if I have been with Ubuntu for 1 year and now I want to switch to Debian, I can do the same procedures in installing dependencies configuration etc., so how is it done in ubuntu is done in debian in the same way ????????… help thanks.

  123.   katherine said

    Hi. I have a question when I put cd .. it doesn't work for me, it tells me that it has not found that command, the same thing happens to me when I put tree. Is there someone who can help me, thank you

    1.    George said

      You have to put the cd command separated from the .. with a space, such that cd ..
      The tree command may not be installed in your shell, you can check the commands that you have installed in your shell in the / bin folder

  124.   George said

    You have to put the cd command separated from the .. with a space, such that cd ..
    The tree command may not be installed in your shell, you can check the commands that you have installed in your shell in the / bin folder

  125.   Ivan said

    Hello, I wanted to know if you authorize me to put this post on my website, for the record that in the said post I will put the source of it

  126.   Lissette De Los Santos Cabrera said

    Very good page!

  127.   Mauricio said

    Thank you very much.
    Excellent information!!

  128.   Walter P. said

    Can you help me as I install the video drivers AMD / ATI TRINITY RADEON HD7660D I have installed Fedora 24

    Thank you

  129.   Delia garcia said

    A marvel this post. Indispensable for those of us who are learning, THANK YOU !!!

  130.   fairy kings said

    You are great!!
    thanks guys =)

  131.   rosemary said

    Thank you! Finally a key summary to have as a header.

  132.   x man said

    I have seen many Linuxero throughout my life, but never anything more complete and well organized.
    I drag him to the lands of the Chameleon (, and I thank you on behalf of the Forum and in my person for such magnificent work.

    Have a lot of Fun !!

  133.   Tomeu said


    Can the article be copied to a text file?

    Very kind, thank you,

    1.    James said

      Select it with the mouse, then Ctrl-V at the same time, open a word file, press the right mouse button, in the context menu, select the icon with the letter A (only plain text).

  134.   mary said

    Has any of this changed for current versions like Kali 2016.2 or Ubuntu 16? Esq I'm just learning and I tried some commands and directories that after spending days looking for it turned out that they no longer exist or they were moved as the versions pass, and here are courses or pdf that I find are from 2012 2010 a course that is called lpic1 I think that It is about all that and it is outdated, I hope this helps me, regards

    1.    pepper said

      you should sign up for LPIC1 and study since the current is valid and touch and read about systemd since you start very late

  135.   Daniel Alanis said

    Friends of the blog, I would like you to help me with a problem that I have quite strong, they hacked my server and changed my root user and I can no longer have access to anything, they took away privileges from everything, some of you will have a solution that can help me with this topic? I would greatly appreciate it.

  136.   Pedro said

    very good

  137.   Jesus Romero said


  138.   Wilmer lopez said

    Excellent post, great compilation of commands, in truth most are important in the world of work. Thank you!!!

  139.   jhony said

    excellent contribution friend thanks for your dedication

  140.   zoilon36 said

    Very good work, thanks.

  141.   Sergio said

    Thank you for bothering to make this contribution.

  142.   twiggy.garcia said

    Thank you very much Elav, I already copied it into a text file to have it handy when you need to consult.
    Excellent contribution !!!!

  143.   david abreu said

    Thanks to the team from DesdeLinux for the contribution and also to those of GUTL there in Cuba, from time to time visit their page, it is very good, I say it from experience:

  144.   Daniel Perez said

    Friend, your contribution is wonderful, thank you, thanks to you, quantum mechanics and particle physics, it is easier to program it… good afternoon….

  145.   windows said

    incredible list of commands, a good season is coming fiddling with linux! I will gain more experience, I love Linux more and more, having control is the best, thanks for the article, I'll tell you how it goes, I hope it's great.

  146.   Marcelo said

    Congratulations and thank you very much for this contribution, your commands and those of the user who mentions the «rosetta stone» are fantastic! Thanks guys, chapó.

  147.   willy said

    excellent contribution. but my memory is volatile to store all those commands

  148.   Mark said

    Hello I am from Lima - Ate Vitarte I would like to learn in some classes how to learn to know from scratch Something about Linux, Parrot, fluxion from my NETBOOK and that they advise and help to RECOGNIZE and SEE the Users and passwords around me.

  149.   kike83 said

    Hi, great article. Very complete.

    I wanted to make a point in the fourth command in the Files and Directories section (cd: go to the root directory). This command as is, without arguments, actually takes us to our home directory. To the home of our user, not to the root directory (/).

    Greetings and congratulations for the article because it is very good. 😉


    Oh my goodness! I think it is the best contribution of all. The VALLIN is saved this year !!

  151.   erika said

    THANK YOU¡¡¡¡¡¡¡ ♥♥ for a little and I get lost for there jjajjjaja

  152.   JUSTICE said

    wao, I only knew a few, but thanks to this page, I have learned many more codes for linux. I also have my blog, I leave you. a greeting

  153.   Juan mejia said

    Excellent contribution!

  154.   Drumsticks said

    I just needed a linux tutorial.