Simple understanding of Linux commands (2)

Source: Internet
Author: User
Tags gpg recode nslookup rsync

RPM Packages – (Fedora, Redhat and similar systems)
RPM-IVH package.rpm Installing an RPM package
Rpm-ivh–nodeeps package.rpm Install a RPM package and ignore dependency warnings
Rpm-u package.rpm Update a RPM package without changing its configuration file
Rpm-f package.rpm update one to determine which RPM package is installed
Rpm-e package_name.rpm Delete an RPM package
RPM-QA display 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 for an installed package
RPM-QG "System environment/daemons" shows the RPM package for a component
RPM-QL Package_name displays a list of files provided by an already installed RPM package
RPM-QC Package_name Displays a list of configuration files provided by an already installed RPM package
Rpm-q Package_name–whatrequires Displays a list of dependencies that exist with a RPM package
Rpm-q Package_name–whatprovides shows the volume of a RPM package
Rpm-q package_name–scripts Show scripts executed during installation/removal L
Rpm-q Package_name–changelog shows the revision history of a RPM package
rpm-qf/etc/httpd/conf/httpd.conf confirm which RPM package is provided for the given file
RPM-QP package.rpm-l displays a list of files provided by a RPM package that has not been installed
Rpm–import/media/cdrom/rpm-gpg-key Importing a public key digital certificate
Rpm–checksig package.rpm confirm the integrity of a RPM package
RPM-QA Gpg-pubkey confirm the integrity of all RPM packages that have been 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 with care
RPM-VP package.rpm confirm that an RPM package is not installed
Rpm2cpio package.rpm | Cpio–extract–make-directories binRun an executable from an RPM package
rpm-ivh/usr/src/redhat/rpms/ arch/package.rpm installing a built-in package from a RPM source
Rpmbuild–rebuild package_name.src.rpm Build a RPM package from a RPM source

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 and use your own software repository to resolve all dependencies for you
Yum Update package_name.rpm updates all installed RPM packages in the current system
Yum Update package_name updates a RPM package
Yum Remove package_name Delete an RPM package
Yum list lists all packages installed in the current system
Yum search package_name searching for packages in RPM repositories
Yum Clean Packages cleanup rpm cache to delete downloaded packages
Yum Clean headers Delete all header files
Yum Clean all deletes all cached packages and header files

DEB packages (Debian, Ubuntu and similar systems)
Dpkg-i package.deb Install/update a deb Package
Dpkg-r package_name Remove a deb package from the system
DPKG-L display all installed Deb packages in the system
Dpkg-l | grep httpd Displays all 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 displays a list of files provided by a Deb package that is 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 by

APT software tools (Debian, Ubuntu and similar systems)
Apt-get install package_name Installing/updating a deb package
Apt-cdrom install package_name Installing/updating a Deb package from CD
Apt-get update packages in the upgrade list
Apt-get Upgrade upgrade all installed software
Apt-get Remove Package_name A deb package from the system
Apt-get Check to verify that the software repositories that are dependent are correct
Apt-get clean the cache from the downloaded package
Apt-cache Search Searched-package Returns the package name that contains the string you want to search

View File Contents
Cat File1 Viewing the contents of a file starting from the first byte
TAC File1 To reverse view the contents of a file from the last line
More File1 View the contents of a long file
Less file1 is similar to the ' more ' command, but it allows a reverse operation in the same way as a forward operation in a file
Head-2 File1 View the first two lines of a file
Tail-2 File1 View the last two lines of a file
Tail-f/var/log/messages Real-time view of content that is added to a file

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
Cat File1 | Command (SED, grep, awk, grep, etc ...) >> Result.txt Merge The detailed description text of a file and write the introduction to an existing file
grep aug/var/log/messages Find the keyword "/var/log/messages" in the file '
grep ^aug/var/log/messages in file '/var/log/messages ' to find words that begin with "."
grep [0-9]/var/log/messages selects all rows in the '/var/log/messages ' file that contain numbers
grep aug-r/var/log/Search for string "/var/log" in directory ' and subsequent directories '
Sed ' s/stringa1/stringa2/g ' example.txt replace "string1" in Example.txt file with "string2"
Sed '/^$/d ' example.txt remove all blank lines from the Example.txt file
Sed '/
#/d; /^$/d ' Example.txt Remove all comments and blank lines from the Example.txt file
echo ' Esempio ' | TR ' [: Lower:] ' [: Upper:] ' merging upper and lower cell contents
Sed-e ' 1d ' result.txt excluding the first line from the file Example.txt
Sed-n '/stringa1/p ' view lines that contain only the words "String1″"
Sed-e ' s/$//' Example.txt delete the last white space character of each line
Sed-e ' s/stringa1//g ' example.txt only removes the word "string1" from the document and retains all remaining
Sed-n ' 1,5p;5q ' example.txt view the contents from the first line to the 5th line
Sed-n ' 5p;5q ' example.txt view line 5th
Sed-e ' s/00
/0/g ' Example.txt replaces multiple zeros with a single 0
Cat-n file1 number of lines to mark a 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 of the 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, in the middle with "+" distinction
Sort file1 file2 Sorting two contents of a file
Sort File1 File2 | Uniq Remove the set of two files (duplicate lines are retained only one copy)
Sort File1 File2 | Uniq-u Delete the intersection, leaving the other rows
Sort File1 File2 | Uniq-d Remove the intersection of two files (leaving only files that exist in two files)
Comm-1 file1 file2 Compare the contents of two files delete only what ' file1 ' contains
Comm-2 file1 file2 Compare the contents of two files delete only what ' file2 ' contains
comm-3 file1 file2 Compare the contents of two files delete only two files that are common to each other

Character settings and file format conversions
Dos2unix filedos.txt fileunix.txt Convert the format of a text file from Msdos 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 Show all allowable conversion formats

File System Analysis
Badblocks-v/dev/hda1 Check for bad blocks on disk hda1
FSCK/DEV/HDA1 repairing/Checking the integrity of the Linux file system on the HDA1 disk
FSCK.EXT2/DEV/HDA1 repairing/Checking the integrity of the Ext2 file system on the HDA1 disk
E2FSCK/DEV/HDA1 repairing/Checking the integrity of the Ext2 file system on the HDA1 disk
E2fsck-j/dev/hda1 Repairing/checking the integrity of ext3 file systems on HDA1 disks
FSCK.EXT3/DEV/HDA1 repairing/Checking the integrity of the Ext3 file system on the HDA1 disk
FSCK.VFAT/DEV/HDA1 repairing/Checking the integrity of the FAT file system on the HDA1 disk
FSCK.MSDOS/DEV/HDA1 repairing/Checking the integrity of the DOS file system on the HDA1 disk
DOSFSCK/DEV/HDA1 repairing/Checking the integrity of the DOS file system on the HDA1 disk

Initializing a file system
MKFS/DEV/HDA1 creating a file system in the HDA1 partition
MKE2FS/DEV/HDA1 creating a Linux ext2 file system in the HDA1 partition
Mke2fs-j/dev/hda1 Create a Linux ext3 (journaled) file system in the HDA1 partition
Mkfs-t vfat 32-f/dev/hda1 Create a FAT32 file system
Fdformat-n/dev/fd0 formatting a floppy disk
Mkswap/dev/hda3 creating a swap file system

Swap file system
Mkswap/dev/hda3 creating a swap file system
Swapon/dev/hda3 enabling a new swap file system
SWAPON/DEV/HDA2/DEV/HDB3 enable two swap partitions

Backup
Dump-0aj-f/tmp/home0.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 Restoring an interactive backup
Rsync-rogpav–delete/home/tmp synchronization 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 Synchronizing 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 ' to perform a backup of the local disk 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 from the remote directory via SSH
(Tar c/home) | ssh-c [email protected]_addr ' cd/home/backup-home && tar x-p ' copy a local directory from the remote directory via SSH
Tar cf–. | (cd/tmp/backup; tar xf–) copy a directory locally to another location, preserving 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 a 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 a floppy disk
DD if=/dev/fd0 of=/dev/hda bs=512 count=1 recover MBR content from a backup that has been saved to a floppy disk

Disc
Cdrecord-v gracetime=2 Dev=/dev/cdrom-eject Blank=fast-force to clear a rewritable disc content
Mkisofs/dev/cdrom > Cd.iso Create a CD-ROM ISO image file 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– burning a compressed ISO image file
Mount-o Loop Cd.iso/mnt/iso mount an ISO image file
Cd-paranoia-b from a CD to the audio track to the WAV file
cd-paranoia-"-3" from a CD to the audio track to a WAV file (parameter-3)
Cdrecord–scanbus scan bus to identify SCSI channels
DD IF=/DEV/HDC | md5sum Verifying the md5sum encoding of a device, such as a CD

Networking – (Ethernet and WiFi wireless)
Ifconfig eth0 shows the configuration of an Ethernet card
Ifup eth0 enable a ' eth0 ' network device
Ifdown eth0 Disable a ' eth0 ' network device
Ifconfig eth0 192.168.1.1 netmask 255.255.255.0 control IP Address
Ifconfig eth0 promisc set ' eth0 ' into promiscuous mode to sniff packets (sniffing)
Dhclient eth0 enable ' eth0 ' in DHCP mode
Route-n Show routing Table
Route add-net 0/0 GW ip_gateway Configura default Gateway
Route add-net 192.168.0.0 netmask 255.255.0.0 GW 192.168.1.1 Configure static route to reach network ' 192.168.0.0/16 '
Route del 0/0 GW ip_gateway remove static route
echo "1" >/proc/sys/net/ipv4/ip_forward activate IP routing
Hostname show hostname of system
Host www.example.com lookup hostname to resolve name to IP address and viceversa (1)
nslookup www.example.com lookup hostname To resolve name to IP address and viceversa (2)
IP link Show Show link status of all interfaces
Mii-tool eth0 Show link status of ' eth0 '
Ethtool eth0 Show statistics of the network card ' eth0 '
Netstat-tup Show all active network connections and their PID
NETSTAT-TUPL Show all network services listening on the system and their PID
Tcpdump TCP port Show all HTTP traffic
Iwlist Scan Show Wireless networks
Iwconfig eth1 Show configuration of a wireless network card
Hostname show hostname
Host www.example.com lookup hostname to resolve name to IP address and viceversa
nslookup www.example.com lookup hostname To resolve name to IP address and viceversa
Whois www.example.com lookup on Whois database

Simple understanding of Linux commands (2)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.