Basic commands under Linux

Source: Internet
Author: User

The following command is for the basic commands under the Redhat version.

The process of compressing and quitting smoking needs to be handled using different commands. Its compression and decompression commands are not the same, so according to the different suffix names, to carry out different commands to deal with.
*.gz <-> gzip Command compressed files
*.bz2 <-> bzip2 Command Compressed files
*.tar <-> tar command packaged files
*.tar.gz <-> tar after packaging, then gzip compressed files
*.tar.bz2 <-> tar commands are packaged and then bzip2 compressed files

The meaning of packaging: to convert a directory into a file, note: The TAR command is only packaged, plus the z option is the compression

Compression and Decompression commands:

First, compression decompression-gzip
Format: gzip [option] File name
Example:
1. gzip/home/book/a.txt Compressed file , there will be a.txt.gz
2. gzip –d /root/home/a.txt.gz Extract the file , it will be reverted to A.txt

Second, compression decompression-BZIP2
Format: bzip2 [options] File name
Example:
1. bzip2 /home/book/a.txt Compressed file will appear a.txt.bz2
2. bzip2 –d /root/home/a.txt.bz2 unzip the file will revert to A.txt

Note: BZIP2 's compression capability does not have a strong gzip

Packaging compression-tar
Format: tar [options] directory or file
Example:
1. Tar cvf tmp.tar/tmp package The TMP directory as a file Tmp.tar, remembering that the suffix name is best. Tar
2. Tar xvf Tmp.tar unpacking the files
3. tar cvzF tmp.tar.gz/tmp to package The TMP directory as a file and compress
4. Tar XVzF tmp.tar.gz to unpack and decompress files

Common options for Tar

-C Create a new archive
-F when used with the-C option , the tar file that is created uses the specified file name for that option;
When used with the-X option, the archive specified by the option is unpacked.
-T displays a list of files in a tar file
-V shows the progress of the archive or solution
-Z use gzip to compress tar files
-j using bzip2 to compress tar files

Three, Disk Management class command

Loading the disc-mount

Format: Mount [options] Device name mount Directory
Example:
1.mount/dev/cdrom/mnt

Attention:

The Redhat Linux mount/dev/cdrom/mnt Mount CD is always present, unable to find media or

Mount:you must specify the filesystem type.

The error was found in my VMware setup and requires the optical drive to be connected to VMware: Select Connect

Unmount the disc-umount
Format: Umount mount Directory
Example:
1. umount/mnt
Note: Please ensure that the user has exited the MNT directory before executing umount

V. View Disk-DF
Format: DF [option]
Example: DF-HL

VI. View Memory-free
Format: free [options]
Example: Free

Seven: Software management-rpm
Format: RPM [options] [package]
Example:
1. rpm–ivh/mnt/packages/xinetd-2.3.14-34.el6.i686. RPM installation xinetd-2.3.14-34.el6.i686.rpm
2. Rpm–qaViewAll packages already installed in the system
3. Rpm–e xinetd-2.3.14-34.el6.i686(Note: The rpm suffix is not followed)UninstallThe xinetd-2.3.14-34.el6.i686 already installed

Excerpt from: http://www.linuxidc.com/Linux/2012-06/62114.htm

Problem: When switching to root user, using Su root and su-root have the same effect, do not know what the difference between them.

Solve:

su-root is a switch to the root account, using the root user's environment variables;
The su root is the root privilege to execute the program as root, but retains the original user environment.

Note: Some commands, even if you use SU root to switch to the root user, still cannot execute, so when switching to the root user, it is recommended to use Su-root.

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.