System Information The processor architecture of the Arch Display Machine (1) UNAME-M display the processor architecture of the Machine (2) uname-r display the kernel version dmidecode-q display hardware system parts-(SMBIOS/DMI) hdparm-i/dev/ HDA lists the architecture characteristics of a disk HDPARM-TT/DEV/SDA perform a test read operation on disk cat/proc/cpuinfo display information about CPU Info cat/proc/interrupts display Interrupt Cat/proc/memi NFO Check memory use Cat/proc/swaps show which swap is used cat/proc/version display kernel version cat/proc/net/dev display network adapter and statistics cat/proc/mounts show loaded file system Lspci-tv List of PCI devices LSUSB-TV display USB device date display system Day Cal 2007 Display 2007 Calendar table date 041217002007.00 set the day and time-month day year. Seconds clock-w Time modification saved to BIOS shutdown (System shutdown, restart and logout) shutdown-h now shutdown system (1) INIT 0 shutdown system (2) Telinit 0 Shutdown System (3) shutdown-h Hours:minutes & Press Scheduled time off System shutdown-c cancel on scheduled time off system Shutdown-r now restart (1) reboot restart (2) Logout unregister files and directories Cd/home enter '/home ' directory ' CD. Go back to the top level directory CD. /.. Go back to the two level directory CD enter the personal home directory CD ~user1 Enter the personal home directory CD-back to the last directory where PWD displays the work path LS view the files in the directory Ls-f view the files in the directory ls-l display the file and directory details ls-a show hidden text The LS *[0-9]* displays the file name and directory name that contains the numbers. Tree display files and directories starting with the root directory (1) Lstree Show files and directories tree structure starting with the root directory (2) mkdir dir1 Create a directory called ' Dir1 ' mkdir di R1 DIR2 simultaneously creates twoDirectory mkdir-p/tmp/dir1/dir2 Create a directory tree rm-f file1 Delete a file called ' file1 ' rmdir dir1 Delete a directory called ' Dir1 ' rm-rf dir1 delete one called ' Dir1 ' Directory and delete its contents RM-RF dir1 dir2 simultaneously deletes two directories and their contents MV Dir1 new_dir rename/move a directory CP file1 file2 copy a file CP dir/*. Copy all files under a directory to the current working directory Cp-a/tmp/dir1. Copy a directory to the current working directory cp-a dir1 dir2 copy a directory ln-s file1 lnk1 Create a soft link to a file or directory ln file1 lnk1 Create a physical link to a file or directory touch-t 0712250000 F Ile1 Modify the timestamp of a file or directory-(YYMMDDHHMM) file file1 outputs the MIME type of the file as text iconv-l lists the known encodings Iconv-f fromencod Ing-t toencoding inputfile > OutputFile creates a new from the given input file by assuming it's encoded in fromencod ing 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) file Search Find/-name file1 from '/' Start into root filesystem search files and directories find/-user User1 search for files and directories belonging to user ' User1 ' find/home/user1-name \*.bin in directory '/Home/user1 ' Search for files with '. bin ' at the end of Find/usr/bin-type f-atime +100 search for executed files that have not been used in the last 100 days Find/usr/bin-type f-mtime-10 search in 1 Files created or modified within 0 days Find/-name \*.rpm-exec chmod 755 ' {} '; Search for files ending with '. RPM ' and define their permissions find/-xdev-name \*.rpm search for files ending with '. RPM ', ignoring the removable devices such as optical drives, locate \*.ps looking for files ending with '. ps '-run ' update first ' DB ' command Whereis halt displays the location of a binary file, source code, or man which halt displays the full path of a binary file or executable mount a file system mount/dev/hda2/mnt/hda2 mount a disk called Hda2- OK directory '/mnt/hda2 ' already exists umount/dev/hda2 uninstall a disk called Hda2-first from Mount point '/mnt/hda2 ' exit fuser-km/mnt/hda2 Force uninstall when device is busy umount-n/mnt /hda2 run unload operation without writing/etc/mtab file-very useful when the file is read-only or when the disk is full mount/dev/fd0/mnt/floppy mount a floppy disk mount/dev/cdrom/mnt/cdrom mount a CDROM or D Vdrom Mount/dev/hdc/mnt/cdrecorder mount a CDRW or dvdrom mount/dev/hdb/mnt/cdrecorder mount a CDRW or dvdrom Mount-o loop file.iso /mnt/cdrom mount a file or ISO image file mount-t vfat/dev/hda5/mnt/hda5 mount a Windows FAT32 file system Mount/dev/sda1/mnt/usbdisk mount a USB Czech disk or flash device mount-t smbfs-o username=user,password=pass//winclient/share/mnt/share mount a WINdows network shared disk space Df-h displays the list of partitions that have been mounted LS-LSR |more file and directory in size du-sh dir1 estimate directory ' Dir1 ' already used disk space ' Du-sk * | SORT-RN displays the size of the file and directory according to capacity rpm-q-a--qf '%10{size}t%{name}n ' | SORT-K1,1N the space used by the installed RPM package (Fedora, Redhat class System) dpkg-query-w-f= ' ${installed-size;10}t${package}n ' on a per-size basis | SORT-K1,1N Displays the space used by the installed Deb package on a size basis (Ubuntu, Debian system) return top index ^ users and groups Groupadd Group_name create a new user group Groupdel group_name Delete a User group Groupmod-n new_group_name old_group_name Rename a user group useradd-c "name Surname"-G admin-d/home/user1-s/bin/bash use R1 Create a user belonging to the "admin" user group Useradd user1 create a new user Userdel-r user1 delete a user ('-R ' exclude home directory) usermod-c "User FTP"-G system-d/F Tp/user1-s/bin/nologin User1 Modify user Properties passwd Modify password passwd user1 modify a user's password (root only) chage-e 2005-12-31 user1 set the expiration period of the user's password PWCK check the file format and syntax corrections for '/etc/passwd ' and the existing user grpck check the '/etc/passwd ' file format and syntax corrections as well as the presence of groups Newgrp Group_name login into a new group to change the preset group of newly created files Group returns the top index ^ file permissions-use "+" to set permissions, use "-" to suppress LS-LH display permissions Ls/tmp | Pr-t5-w$columns the terminal into 5 columns display chmod ugo+rwx Directory1 Set the directory owner (U), Group (g), and others (O) to read (R), write (w), and execute (x) permissions chmod go-rwx directory1 Delete the group (g) Read and write execution permissions to the directory with other People (O) Chown user1 File1 change the Owner property of a file Chown-r user1 directory1 Change the owner property of a directory and change the properties of all files in the directory chgrp group1 file1 change the file group Chown user1:group1 fi Le1 changing the owner and group properties of a file Find/-perm-u+s lists all files in a system that use SUID control chmod u+s/bin/file1 set a SUID bit of a binary file-the user who runs the file is also given the same permissions as the owner chmod u-s/bin/file1 Disables the suid bit of a binary file chmod g+s/home/public set a directory Sgid bit-similar to suid, but this is for the directory chmod g-s/home/public Disable a The SGID bit of the directory chmod o+t/home/public set the STIKY bit of a file-only allow the legal owner to delete the file chmod o-t/home/public Disable the STIKY bit of a directory return top index ^ file special properties- Use "+" to set permissions, use "-" to cancel Chattr +a file1 only allow append to read and write files chattr +c file1 allow this file to be automatically compressed/decompressed by the kernel chattr +d file1 in the case of file system backup, the dump program will Ignoring this file chattr +i File1 is set to an immutable file that cannot be deleted, modified, renamed, or linked chattr +s file1 allows a file to be safely removed chattr +s File1 Once the application writes to the file, the system immediately changes the The result is written to disk chattr +u file1 If the file is deleted, the system will allow you to restore the deleted file later lsattr display special properties back to the top index ^ packing and compressing files bunzip2 file1.bz2 extracting a file called ' file1.bz2 ' B ZIP2 File1 compresses a text called ' File1 'Piece Gunzip file1.gz extract a file called ' file1.gz ' gzip file1 compress a file called ' file1 ' gzip-9 file1 maximum compression rar A File1.rar test_file create a call ' File1.rar ' package rar a file1.rar file1 file2 dir1 simultaneous compression ' file1 ', ' file2 ' as well as directory ' Dir1 ' rar x file1.rar decompression rar package Unrar x File1.rar Unzip the RAR package TAR-CVF Archive.tar file1 Create a non-compressed tarball tar-cvf archive.tar file1 file2 dir1 Create a containing ' file1 ', ' file2 ' and ' dir 1 ' profile TAR-TF Archive.tar displays the contents of a package TAR-XVF Archive.tar release a package TAR-XVF ARCHIVE.TAR-C/TMP releases the compressed package into the/tmp directory TAR-CVFJ AR CHIVE.TAR.BZ2 Dir1 Create a bzip2 format compression package TAR-XVFJ archive.tar.bz2 extract a bzip2 format package TAR-CVFZ archive.tar.gz Dir1 Create a zipped package in gzip format TAR-XVFZ archive.tar.gz Unzip an gzip compressed package zip file1.zip file1 Create a zip-format compression package zip-r file1.zip file1 file2 dir1 to compress several files and directories into A zip-format compression package unzip File1.zip unzip a zip-format package to return the top index ^RPM package-(Fedora, Redhat and similar systems) RPM-IVH package.rpm Install an RPM package RPM-IVH--no Deeps package.rpm Install a RPM package and ignore the dependency warning Rpm-u package.rpm Update an RPM package without changing its profile rpm-f package.rpm update A to determine which RPM package is installed RPM-E packages _name.rpm Delete a RPM package rpm-qA displays all installed RPM packages in the system Rpm-qa | grep httpd shows all RPM packages with the words "httpd" in their names Rpm-qi package_name get special information about an installed package RPM-QG "System environment/daemons" to display RPM packages for a component R PM-QL Package_name displays a list of files provided by an already installed RPM package RPM-QC Package_name shows a list of profiles provided by an installed RPM package rpm-q package_name--whatrequires display A list of dependencies that exist with a RPM package rpm-q package_name--whatprovides shows the volume of an RPM package rpm-q package_name--scripts shows scripts executed during installation/removal L RPM-Q p Ackage_name--changelog shows the modification history of a RPM package rpm-qf/etc/httpd/conf/httpd.conf the given file is provided by which RPM package RPM-QP package.rpm-l display by a not yet Installed RPM package provided file list rpm--import/media/cdrom/rpm-gpg-key Import public key digital certificate rpm--checksig package.rpm confirm an RPM package integrity Rpm-qa Gpg-pubkey Verify the integrity of all RPM packages installed rpm-v package_name Check file size, license, type, owner, group, MD5 check, and last modified time Rpm-va check all installed RPM packages in the system-use RPM-VP package.rpm carefully An RPM package is not yet installed Rpm2cpio package.rpm | Cpio--extract--make-directories *bin* Run executable file from an RPM package rpm-ivh/usr/src/redhat/rpms/' arch '/package.rpm Install a built-in package from a RPM source Rpmbuild--rebuild package_name.src.rpm build an RPM package from a RPM source to return to the top index ^yum package upgrade-(FeDora, Redhat and similar systems) yum install package_name download and install a RPM package Yum Localinstall package_name.rpm will install a RPM package, Use your own repositories to resolve all dependencies for you yum update package_name.rpm updates all installed RPM packages in the current system Yum Update package_name update one RPM package Yum remove Package_nam E Delete a RPM package Yum list lists all packages installed in the current system Yum Search Package_name Search package in rpm repository Yum clean packages cleanup RPM cache Delete downloaded packages yum clear headers Delete all header files Yum Clean all delete all cached packages and header files back to top index ^deb package (Debian, Ubuntu and similar systems) dpkg-i package.deb Install/update a DEB package Dpkg-r packages _name remove a Deb package from the system dpkg-l display all installed Deb packages in the system Dpkg-l | grep httpd displays all of the Deb packages with the words "httpd" in their names dpkg-s package_name get information on a special package already installed in the system dpkg-l package_name display a list of files provided by a Deb package already installed in the system Dpkg--contents Package.deb shows a list of files provided by a package that has not yet been installed Dpkg-s/bin/ping confirm which Deb package the given file is provided back to top index ^APT software tools (Debian, Ubuntu, and similar systems ) apt-get Install Package_name installs/updates a Deb package Apt-cdrom install package_name a package from CD installation/update a DEB package apt-get update upgrade list apt- Get upgrade upgrade all installed software Apt-get Remove Package_name removes a Deb package from the system Apt-get check confirms that the dependent repositories are correct apt-get clean from the downloaded packageApt-cache Search Searched-package Returns the package name that contains the string you want to search returns the top index ^ view file contents Cat File1 View the contents of the file starting from the first byte the TAC file1 starts in reverse from the last line to view a The contents of the file more File1 view the contents of a long file less file1 is similar to the ' more ' command, but it allows the reverse operation in the same file as the forward Operation Head-2 File1 view the first two lines of a file Tail-2 file1 view a file of the most The last two lines tail-f/var/log/messages Live View is added to the contents of a file return top index ^ text processing 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.txt Merge the detailed description text of a file and write the introduction to a new file in Cat File1 | Command (SED, grep, awk, grep, etc ...) >> Result.txt Merge The detailed description text of a file and write an introduction to an existing file in grep aug/var/log/messages in file '/V Ar/log/messages ' Find the keyword "^aug/var/log/messages" grep in the file '/var/log/messages ' to find the word grep starting with "" [0-9]/var/log/ Messages selects all rows in the '/var/log/messages ' file that contain numbers, grep aug-r/var/log/* searches the directory '/var/log ' and the subsequent directories for the string "the" "The" "The" "The" sed "s/stringa1/string A2/g ' example.txt Replace "string1" in Example.txt file with "string2" sed '/^$/d ' example.txt remove all blank lines from example.txt file sed '/*#/d; /^$/d ' Example.txt Remove all comments and blank lines from the Example.txt file echo ' Esempio ' | TR ' [: Lower:] ' [: Upper:] ' merge up and down cell contents sed-e ' 1d ' result.txt exclude first line from file Example.txt sed-n '/stringa1/p ' view rows containing only the word "string1" Sed-e ' s/*$//' example.txt delete the last white space character of each line sed-e ' s/stringa1//g ' example.txt remove only the word "string1" from the document and leave all remaining sed-n ' 1,5p;5q ' Example.txt SearchLook from the first line to the 5th row of content sed-n ' 5p;5q ' example.txt view 5th row sed-e ' s/00*/0/g ' example.txt replace multiple 0 cat-n file1 with a single 0 number of lines in the file cat Example.txt | awk ' nr%2==1 ' deletes all even lines in the Example.txt file echo a b C | awk ' {print '} ' view one row first column echo a b C | awk ' {print $1,$3} ' view the first and third columns of a row paste file1 file2 merge two files or two columns of content paste-d ' + ' file1 file2 merge two files or two columns of content, with "+" in the middle to distinguish sort file1 f Ile2 sort the contents of two files sort file1 file2 | Uniq Remove the set of two files (duplicate lines retain only one copy) sort file1 file2 | Uniq-u Delete intersection, leave other lines sort file1 file2 | Uniq-d Remove the intersection of two files (leaving only the files that exist in two files) comm-1 file1 file2 Compare the contents of two files delete only the contents of ' File1 ' comm-2 file1 file2 Compare the contents of two files delete only ' file 2 ' contains content comm-3 file1 file2 Compare the contents of two files delete only two files in common part returns the top index ^ character set and file format conversion Dos2unix filedos.txt fileunix.txt formats a text file from Msdos Convert to UNIX unix2dos fileunix.txt filedos.txt convert the format of a text file from UNIX to Msdos Recode. Html<page. txt> page.html Convert a text file to HTML Recode-l | More display all allowed conversion formats Return top index ^ file system analysis Badblocks-v/dev/hda1 check for bad magnetic blocks on disk hda1 fsck/dev/hda1 repair/Check the integrity of the Linux file system on the HDA1 disk fsck.ext2/d EV/HDA1 Repair/Check the integrity of ext2 file system on HDA1 disk E2FSCK/DEV/HDA1 repair/check hda1 file system integrity ext2 E2FSCK-J Repair/ Check the integrity of the Ext3 file system on the HDA1 disk FSCK.EXT3/DEV/HDA1 repair/check ext3 file system integrity on HDA1 disk FSCK.VFAT/DEV/HDA1 repair/Check the integrity of the FAT file system on the HDA1 disk FSCK.MSDOS/DEV/HDA1 Repair/Check the integrity of the DOS file system on the HDA1 disk DOSFSCK/DEV/HDA1 repair/Check the integrity of the DOS file system on the HDA1 disk return top index ^ initialize a file system mkfs/dev/hda1 Create a file system on the HDA1 partition mke2fs/dev/hda1 create a Linux ext2 file system on the HDA1 partition mke2fs-j/dev/hda1 Create a Linux hda1 (journaled) file system ext3 VF in MKFS-T partition At 32-f/dev/hda1 Create a FAT32 file system fdformat-n/dev/fd0 format a floppy disk Mkswap/dev/hda3 create a swap file system return top index ^swap file system Mkswap/dev /HDA3 Create a swap file system Swapon/dev/hda3 enable a new swap file system SWAPON/DEV/HDA2/DEV/HDB3 enable two swap partitions return top index ^ backup dump-0aj-f/tmp/home 0.bak/home make a full backup of the '/home ' directory Dump-1aj-f/tmp/home0.bak/home make an interactive backup of the '/home ' directory Restore-if/tmp/home0.bak restore an interaction -Backup Rsync-rogpav--delEte/home/tmp sync on both sides of the directory rsync-rogpav-e ssh--delete/home ip_address:/tmp via ssh channel rsync rsync-az-e ssh--delete ip_addr: /home/public/home/local synchronizes a remote directory to a local directory via SSH and compression rsync-az-e ssh--delete/home/local ip_addr:/home/public Synchronizing a local directory to a remote directory via SSH and compression dd bs=1m If=/dev/hda | gzip | SSH [email protected]_addr ' dd of=hda.gz ' performs a backup of the local disk operation on the remote host via SSH DD IF=/DEV/SDA of=/tmp/file1 backup disk contents to a file Tar- Puf Backup.tar/home/user performs an interactive backup operation on the '/home/user ' directory (cd/tmp/local/&& tar c.) | ssh-c [email protected]_addr ' cd/home/share/&& tar x-p ' Copy a directory content (Tar c/home) from the remote directory via SSH | ssh-c [email protected]_addr ' cd/home/backup-home && tar x-p ' copy a local directory in the remote directory via SSH, Tar CF-. | (cd/tmp/backup; tar xf-) copy a directory locally to another place, leaving the original permissions and links find/home/user1-name ' *.txt ' | Xargs Cp-av--target-directory=/home/backup/--parents Find and copy all files ending with '. txt ' from one directory to another directory find/var/log-name ' *.log ' | Tar CV--files-from=-| bzip2 > log.tar.bz2 Find all files that end with '. Log ' and make a bZIP package DD If=/dev/hda of=/dev/fd0 bs=512 count=1 do an action to copy the contents of the MBR (Master Boot Record) to the floppy disk DD if=/dev/fd0 Of=/dev/hda bs=512 count=1 Recovering MBR content from a backup that has been saved to a floppy disk returns the top index ^ disc cdrecord-v gracetime=2 dev=/dev/cdrom-eject Blank=fast-force clears a rewritable disc content mkisofs/dev/ CDROM > Cd.iso Create an ISO image file for a disc on disk Mkisofs/dev/cdrom | Gzip > Cd_iso.gz Create a compressed disc ISO image file on disk mkisofs-j-allow-leading-dots-r-V "Label CD"-iso-level 4-o./cd.iso data_cd Create an ISO image file for a directory cdrecord-v dev=/dev/cdrom cd.iso burning an ISO image file Gzip-dc cd_iso.gz | Cdrecord Dev=/dev/cdrom-Burn a compressed ISO image file Mount-o loop cd.iso/mnt/iso mount an ISO image file Cd-paranoia-b from one CD to the audio track to the WAV file CD -paranoia--"-3" from a CD to the audio track to the WAV file (parameter-3) Cdrecord--scanbus Scan Bus to identify the SCSI channel DD IF=/DEV/HDC | md5sum Verifying the md5sum encoding of a device, such as a CD
LINUX Operations Command Daquan