Linux Commands Reference
Command | Description |
System information & Details | |
| show architecture of machine |
| show the timetable of 2007 |
| show information CPU info |
| show interrupts |
| verify memory use |
| show file(s) swap |
| show version of the kernel |
| show network adpters and statistics |
| show mounted file system(s) |
| save date changes on BIOS |
| show system date |
| set date and time - MonthDayhoursMinutesYear.Seconds |
| show hardware system components - (SMBIOS / DMI) |
| displays the characteristics of a hard-disk |
| perform test reading on a hard-disk |
| display PCI devices |
| show USB devices |
| show architecture of machine |
| show used kernel version |
Shutdown, Restart and Logout of a system | |
| shutdown system |
| leaving session |
| reboot |
| shutdown system |
| planned shutdown of the system at 16:30 |
| cancel a planned shutdown of the system |
| reboot |
| shutdown system |
Files and Directory | |
| enter to directory '/ home' |
| go back one level |
| go back two levels |
| go to home directory |
| go to home directory |
| go to previous directory |
| copying a file |
| copy all files of a directory within the current work directory |
| copy a directory within the current work directory |
| copy a directory |
| outputs the mime type of the file as text |
| lists known encodings |
| converting the coding of characters from one format to another |
| batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick) |
| create a symbolic link to file or directory |
| create a physical link to file or directory |
| view files of directory |
| view files of directory |
| show details of files and directory |
| show hidden files |
| show files and directory containing numbers |
| show files and directories in a tree starting from root(2) |
| create a directory called 'dir1' |
| create two directories simultaneously |
| create a directory tree |
| rename / move a file or directory |
| show the path of work directory |
| delete file called 'file1' |
| remove a directory called 'dir1' and contents recursively |
| remove two directories and their contents recursively |
| delete directory called 'dir1' |
| modify timestamp of a file or directory - (YYMMDDhhmm) |
| show files and directories in a tree starting from root(1) |
File search | |
| search file and directory into root filesystem from '/' |
| search files and directories belonging to 'user1' |
| search files with '. bin' extension within directory '/ home/user1' |
| search binary files are not used in the last 100 days |
| search files created or changed within 10 days |
| search files with '.rpm' extension and modify permits |
| search files with '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc.… |
| find files with the '.ps' extension - first run 'updatedb' command |
| show location of a binary file, source or man |
| show full path to a binary / executable |
Mounting a Filesystem | |
| force umount when the device is busy |
| mount disk called hda2 - verify existence of the directory '/ mnt/hda2' |
| mount a floppy disk |
| mount a cdrom / dvdrom |
| mount a cdrw / dvdrom |
| mount a cdrw / dvdrom |
| mount a file or iso image |
| mount a Windows FAT32 file system |
| mount a usb pen-drive or flash-drive |
| mount a windows network share |
| unmount disk called hda2 - exit from mount point '/ mnt/hda2' first |
| run umount without writing the file /etc/mtab - useful when the file is read-only or the hard disk is full |
Disk Space | |
| show list of partitions mounted |
| show the used space by installed deb packages, sorting by size (debian, ubuntu and alike) |
| estimate space used by directory 'dir1' |
| show size of the files and directories sorted by size |
| show size of the files and directories ordered by size |
| show the used space by rpm packages installed sorted by size (fedora, redhat and alike) |
Networking (LAN / WiFi) | |
| active interface 'eth0' in dhcp mode |
| show network statistics of eth0 |
| lookup hostname to resolve name to ip address and viceversa |
| show hostname of system |
| show configuration of an ethernet network card |
| configure IP Address |
| configure 'eth0' in promiscuous mode to gather packets (sniffing) |
| disable an interface 'eth0' |
| activate an interface 'eth0' |
| show link status of all network interfaces |
| show wireless networks |
| wifi scanning to display the wireless connections available |
| show link status of 'eth0' |
| show all active network connections and their PID |
| show all network services listening on the system and their PID |
| show routing table alike "route -n" |
| lookup hostname to resolve name to ip address and viceversa |
| show routing table |
| configure default gateway |
| configure static route to reach network '192.168.0.0/16' |
| remove static route |
| activate ip routing temporarily |
| show all HTTP traffic |
| lookup on Whois database |
Users and Groups | |
| set deadline for user password |
| create a new group |
| delete a group |
| rename a group from moon to sun |
| check correct syntax and file format of '/etc/group' and groups existence |
| log into a new group to change default group of newly created files |
| change password |
| change a user password (only by root) |
| check correct syntax and file format of '/etc/passwd' and users existence |
| create a new user "user1" belongs "admin" group |
| create a new user |
| delete a user ( '-r' eliminates home directory) |
| change user attributes as description, group and other |
Permits on Files | |
| change group of files |
| set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o) |
| remove permits reading (r), write (w) and (x) access to users group (g) and others (or |
| set SUID bit on a binary file - the user that running that file gets same privileges as owner |
| disable SUID bit on a binary file |
| set SGID bit on a directory - similar to SUID but for directory |
| disable SGID bit on a directory |
| set STIKY bit on a directory - allows files deletion only to legitimate owners |
| disable STIKY bit on a directory |
| change owner of a file |
| change user owner of a directory and all the files and directories contained inside |
| change user and group ownership of a file |
| view all files on the system with SUID configured |
| show permits on files |
| divide terminal into 5 columns |
Special Attributes on files | |
| allows write opening of a file only append mode |
| allows that a file is compressed / decompressed automatically by the kernel |
| makes sure that the program ignores Dump the files during backup |
| makes it an immutable file, which can not be removed, altered, renamed or linked |
| allows a file to be deleted safely |
| makes sure that if a file is modified changes are written in synchronous mode as with sync |
| allows you to recover the contents of a file even if it is canceled |
| show specials attributes |
Archives and compressed files | |
| decompress a file called 'file1.bz2' |
| compress a file called 'file1' |
| decompress a file called 'file1.gz' |
| compress a file called 'file1' |
| compress with maximum compression |
| create an archive rar called 'file1.rar' |
| compress 'file1', 'file2' and 'dir1' simultaneously |
| decompress rar archive |
| create a uncompressed tarball |
| create an archive containing 'file1', 'file2' and 'dir1' |
| show contents of an archive |
| extract a tarball |
| extract a tarball into / tmp |
| create a tarball compressed into bzip2 |
| decompress a compressed tar archive in bzip2 |
| create a tarball compressed into gzip |
| decompress a compressed tar archive in gzip |
| decompress rar archive |
| decompress a zip archive |
| create an archive compressed in zip |
| compress in zip several files and directories simultaneously |
RPM Packages ( Fedora, Red Hat and like) | |
| install a rpm package |
| install a rpm package ignoring dependencies requests |
| upgrade a rpm package without changing configuration files |
| upgrade a rpm package only if it is already installed |
| remove a rpm package |
| show all rpm packages installed on the system |
| show all rpm packages with the name "httpd" |
| obtain information on a specific package installed |
| show rpm packages of a group software |
| show list of files provided by a rpm package installed |
| show list of configuration files provided by a rpm package installed |
| show list of dependencies required for a rpm packet |
| show capability provided by a rpm package |
| show scripts started during installation / removal |
| show history of revisions of a rpm package |
| verify which rpm package belongs to a given file |
| show list of files provided by a rpm package not yet installed |
| import public-key digital signature |
| verify the integrity of a rpm package |
| verify integrity of all rpm packages installed |
| check file size, permissions, type, owner, group, MD5 checksum and last modification |
| check all rpm packages installed on the system - use with caution |
| verify a rpm package not yet installed |
| install a package built from a rpm source |
| extract executable file from a rpm package |
| build a rpm package from a rpm source |
YUM packages tool (Fedora, RedHat and alike) | |
| download and install a rpm package |
| That will install an RPM, and try to resolve all the dependencies for you using your repositories. |
| update all rpm packages installed on the system |
| upgrade a rpm package |
| remove a rpm package |
| list all packages installed on the system |
| find a package on rpm repository |
| clean up rpm cache erasing downloaded packages |
| remove all files headers that the system uses to resolve dependency |
| remove from the cache packages and headers files |
DEB packages (Debian, Ubuntu and like) | |
| install / upgrade a deb package |
| remove a deb package from the system |
| show all deb packages installed on the system |
| show all deb packages with the name "httpd" |
| obtain information on a specific package installed on system |
| show list of files provided by a package installed on system |
| show list of files provided by a package not yet installed |
| verify which package belongs to a given file |
APT packages tool (Debian, Ubuntu and alike) | |
| returns list of packages which corresponds string "searched-packages" |
| install / upgrade a deb package from cdrom |
| install / upgrade a deb package |
| update the package list |
| upgrade all of the installed packages |
| remove a deb package from system |
| verify correct resolution of dependencies |
| clean up cache from packages downloaded |
Pacman packages tool (Arch, Frugalware and alike) | |
| Install package 'name' with dependencies |
| Delete package 'name' and all files of it |
View file content | |
| view the contents of a file starting from the first row |
| view first two lines of a file |
| similar to 'more' command but which allows backward movement in the file as well as forward movement |
| view content of a file along |
| view the contents of a file starting from the last line |
| view last two lines of a file |
| view in real time what is added to a file |
Text Manipulation | |
| remove all even lines from example.txt |
| view the first column of a line |
| view the first and third column of a line |
| number row of a file |
| compare contents of two files by deleting only unique lines from 'file1' |
| compare contents of two files by deleting only unique lines from 'file2' |
| compare contents of two files by deleting only the lines that appear on both files |
| find differences between two files |
| look up words "Aug" on file '/var/log/messages' |
| look up words that begin with "Aug" on file '/var/log/messages' |
| select from file '/var/log/messages' all lines that contain numbers |
| search string "Aug" at directory '/var/log' and below |
| merging contents of two files for columns |
| merging contents of two files for columns with '+' delimiter on the center |
| find differences between two files and merge interactively alike "diff" |
| replace "string1" with "string2" in example.txt |
| remove all blank lines from example.txt |
| remove comments and blank lines from example.txt |
| eliminates the first line from file example.txt |
| view only lines that contain the word "string1" |
| remove empty characters at the end of each row |
| remove only the word "string1" from text and leave intact all |
| print from 1th to 5th row of example.txt |
| print row number 5 of example.txt |
| replace more zeros with a single zero |
| sort contents of two files |
| sort contents of two files omitting lines repeated |
| sort contents of two files by viewing only unique line |
| sort contents of two files by viewing only duplicate line |
| convert from lower case in upper case |
Character set and Format file conversion | |
| convert a text file format from MSDOS to UNIX |
| convert a text file to html |
| show all available formats conversion |
| convert a text file format from UNIX to MSDOS |
Filesystem Analysis | |
| check bad blocks on disk hda1 |
| repair / check integrity of dos filesystems on disk hda1 |
| repair / check integrity of ext2 filesystem on disk hda1 |
| repair / check integrity of ext3 filesystem on disk hda1 |
| repair / check integrity of linux filesystem on disk hda1 |
| repair / check integrity of ext2 filesystem on disk hda1 |
| repair / check integrity of ext3 filesystem on disk hda1 |
| repair / check integrity of fat filesystem on disk hda1 |
| repair / check integrity of dos filesystem on disk hda1 |
Format a Filesystem | |
| format a floppy disk |
| create a filesystem type linux ext2 on hda1 partition |
| create a filesystem type linux ext3 (journal) on hda1 partition |
| create a filesystem type linux on hda1 partition |
| create a FAT32 filesystem |
| create a swap filesystem |
Filesystem SWAP | |
| create a swap filesystem |
| activating a new swap partition |
| activate two swap partitions |
Backup | |
| find all files with '.log' extention and make an bzip archive |
| find and copy all files with '.txt' extention from a directory to another |
| make a backup of a local hard disk on remote host via ssh |
| backup content of the harddrive to a file |
| make a copy of MBR (Master Boot Record) to floppy |
| restore MBR from backup copy saved to floppy |
| make a full backup of directory '/home' |
| make a incremental backup of directory '/home' |
| restoring a backup interactively |
| synchronization between directories |
| rsync via SSH tunnel |
| synchronize a local directory with a remote directory via ssh and compression |
| synchronize a remote directory with a local directory via ssh and compression |
| make a incremental backup of directory '/home/user' |
| copy content of a directory on remote directory via ssh |
| copy a local directory on remote directory via ssh |
| local copy preserving permits and links from a directory to another |
CDROM | |
| rip audio tracks from a CD to wav files |
| rip first three audio tracks from a CD to wav files |
| clean a rewritable cdrom |
| burn an ISO image |
| burn a compressed ISO image |
| scan bus to identify the channel scsi |
| perform an md5sum on a device, like a CD |
| create an iso image of cdrom on disk |
| create a compressed iso image of cdrom on disk |
| create an iso image of a directory |
| mount an ISO image |
Microsoft Windows networks (samba) | |
| mount a windows network share |
| netbios name resolution |
| netbios name resolution |
| show remote shares of a windows host |
| like wget can download files from a host windows via smb |
IPTABLES (firewall) | |
| show all chains of filtering table |
| show all chains of nat table |
| clear all rules from filtering table |
| clear all rules from table nat |
| delete any chains created by user |
| allow telnet connections to input |
| block HTTP connections to output |
| allow POP3 connections to forward chain |
| Logging on input chain |
| configure a PAT (Port Address Traslation) on eth0 masking outbound packets |
| redirect packets addressed to a host to another host |
Monitoring and debugging | |
| displays status of RAM in megabytes |
| force closure of the process and finish it |
| force a process to reload configuration |
| show history reboot |
| display kernel loaded |
| display a list of files opened by processes |
| displays a list of open files in a given path system |
| displays linux tasks |
| displays linux tasks in a hierarchical mode |
| Shows a tree system processes |
| monitoring reliability of a hard-disk through SMART |
| check if SMART is active on a hard-disk |
| display system calls made and received by a process |
| display library calls |
| show events inherent to the process of booting kernel |
| show system events |
| display linux tasks using most cpu |
| display interrupts in real-time |
Others useful commands | |
| set an alias for a command - hh = history |
| 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 |
| change shell command |
| nice command to know if you have to remote into another box |
| encrypt a file with GNU Privacy Guard |
| decrypt a file with GNU Privacy Guard |
| show shared libraries required by ssh program |
| display the on-line manual pages for example on ping command - use '-k' option to find any related commands |
| create a boot floppy |
| download an entire web site |
| download a file with the ability to stop the download and resume later |
| start a download at any given time |
| displays description of what a program does |
| 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 |
Reference : LinuxGuide.it and Google
0 comments :