Brief introduction of Linux command first use

Source: Internet
Author: User
Tags create directory save file

1The  CD command CD command is often used to change the directory [email protected]:~# cd/home/user/Desktop [email protected]:~# CD: Back to previous level [email protected]:~# CD. /.. Return to level Two directory if you do not know the working directory, PWD directly displays the current directory path [email protected]:~# pwd2the . ls command ls command is a list of directory contents (files or folders) [email protected]:~# Lsls-l command to list directory contents (files or folders) in detail mode3the . uname command Displays the machine name, operating system and kernel details [email protected]:~# Unamelinux Tecmint3.8.0- +-generic # --ubuntu SMP Wed May1  -: $: -Utc -i686 i686 i686 gnu/Linux4 . mkdir command mkdir Create a new directory [email protected]:~# mkdir Index creates a folder for index mkdir-p Create directory tree [email protected]:~# mkdir-p/tmp/dir1/Dir2 Create a Dir1 folder under the TMP directory and create a Dir2 folder under Dir1 folder5 . rmdir command rmdir Delete directory [email protected]:~# rmdir Index Delete index folder RM-RF Delete directory at the same time delete the contents of [email protected]:~# RM-RF Dir1 Remove a call'Dir1'directory and delete its contents at the same time. RM-RF Dir1 dir2[email protected]:~# RM-RF Dir1 DIR2 Delete two directories and their contents at the same time6 . VI fight a file without and create a file [email protected]:~# VI Index.txt First press ESC key back to the command mode, vi save the file has different options, corresponding to different commands, you can choose one from the following command: W Save the file but do not exit Vi:w files will be modified to save to file, do not exit vi:w !force save, do not exit Vi:wq save file and exit Vi:wq!force save file and exit Vi:q do not save file, exit Vi:q!do not save the file, Force exit Vi:e!Discard all modifications and last enter. 7 . Touch to create a nonexistent file [email protected]:~# Touch index.html created a index.html file 8. RM- F Delete file [email protected]:~# RM-F index.html Delete a index.html file9 . CP copy files, folders [email protected]:~# CP index.php index2.php copied a index2.php file [email protected]:~# CP-a dir1 dir2 copy a directory [email protected]:~# cp-a/tmp/Dir1. Copy directory to current working directory [email protected]:~# dir/* . Copy all files under directory to current working directory 10.mv Mobile directory [email protected]:~# mv Dir1 DIR3 If dir3 exists, move Dir1 directory to dir3 directory; If Dir3 does not exist, The name of the Dir1 directory is changed to DIR3; [Email protected]:~# mv index.php index3.php Change index.php's file name to index3.php

11. Packaging compression, decompression
[Email protected]:~# bzip2 file1  compress a file named File1

Compressed file is file1.bz2

Bunzip file1,bz2 Extract a file named file1.bz2

gzip File1 compress a file called ' File1 '

Compressed file is file1.gz

Gunzip file1.gz Extract a file called ' file1.gz '

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

Brief introduction of Linux command first use

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.