Linux basic commands

Source: Internet
Author: User

Linux Command Encyclopedia

NOTE: Continuous update

I. files and directories

cd/home Enter '/home ' directory '
CD: Return to the top level directory
CD.. /.. Return to the top level two directory
CD into the personal home directory
CD ~user1 into the personal home directory
CD-Return to the last directory
pwd Display work path
ls to view the files in the directory
ls-f viewing files in a directory
ls-l displaying details of files and directories
ls-a Show hidden files

mkdir dir1 Create a directory called ' Dir1 '
mkdir dir1 DIR2 Create two directories at a time
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 a directory called ' Dir1 ' and delete its contents at the same time
rm-rf dir1 DIR2 Delete two directories and their contents at the same time
MV Dir1 new_dir Renaming/Moving 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


Two. Permissions

Su-Log in as root

LS-LH Display Permissions
ls/tmp | Pr-t5-w$columns the terminal into 5 column display

chmod U+s/bin/file1 sets the 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 for a binary file


Three. packaging and compressing files

bunzip2 file1.bz2 Extract a file called ' file1.bz2 '
bzip2 file1 Compress a file called ' File1 '
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 package called ' File1.rar '
rar a file1.rar file1 file2 dir1 simultaneously compresses ' file1 ', ' file2 ' and directory ' Dir1 '
rar x file1.rar decompression rar package
unrar x file1.rar decompression rar package
TAR-CVF Archive.tar file1 Create a non-compressed tarball
tar-cvf archive.tar file1 file2 dir1 Create a file containing ' file1 ', ' file2 ' and ' Dir1 '
TAR-TF Archive.tar Display 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 archive.tar.bz2 Dir1 Create a compressed package in BZIP2 format
TAR-XVFJ archive.tar.bz2 Extract a compressed package in BZIP2 format
TAR-CVFZ archive.tar.gz Dir1 Create a zipped package in gzip format
TAR-XVFZ archive.tar.gz Unzip a compressed package in gzip format
zip file1.zip file1 Create a zip-format compression Package
zip-r file1.zip file1 file2 Dir1 compresses several files and directories into a zip-format package at the same time
Unzip File1.zip unzip a zip-format tarball


four. 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


Five. Mount a file system 
mount/dev/hda2/mnt/hda2 mount a disk called hda2-ok directory '/mnt/hda2 ' already exists
umount/dev/hda2 unload a disk called Hda2-first from Mount point '/mnt/hda2 ' exit
fuser-km/mnt/hda2 Force unload when the device is busy
umount-n/mnt/hda2 Run unload operation without writing/etc/mtab file-useful when file is read-only or when disk is full
Mount/dev/fd0/mnt/floppy mount a floppy disk
Mount/dev/cdrom/mnt/cdrom mount a cdrom or dvdrom
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 to mount a Windows FAT32 file system
Mount/dev/sda1/mnt/usbdisk mount a USB drive or flash device
mount-t Smbfs-o Username=user,password=pass//winclient/share/mnt/share to mount a Windows network

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.