Linux Basic Commands Learning notes

Source: Internet
Author: User
Tags clear screen

Terminal Use Help

F11 fullscreen

Crtl Shift + Zoom

ctrl– Shrinking

Ctrl u clears the command line ( clears the cursor to the front )

Ctrl l Clear Screen

Shift PgDn PAGE DOWN

Shift pgup PAGE Up

Basic commands

command composition: command word [ parameter ] [ Action Object ]


Mans

Help with the use of CHECK commands

exit the Help document by pressing Q

Ls

LisT directory contents

List the contents of the current directory

LS desktop/

List content in the Desktop directory

./ Current directory

.. / Parent directory of the current directory

Pwd

Print the name of current/working directory

Displays the current working directory

Cd

change Directory

Implementing directory Switching

Cd.. / back to Parent directory

~ User Home directory ( a directory that is proprietary to a Linux/unix account)

CD ~ back to user home directory

CD equivalent to CD ~ back to user home directory

cd– return to the catalogue before the arrival here



Create, delete files and directories

Mkdir

make directory

Create a directory under the current directory

mkdir dir1,dir2,dir3,... Create multiple sibling directories

Mkdir–p a/b/c Creating a three-tier directory

RmDir

remove directory

Delete Empty directory ( no files or directories in this directory )

RmDir dir1,dir2,dir3,... Delete multiple directories

Rmdir–p a/b/c Delete a multilevel directory ( but only one branch )

Touch

Create a file

Touch File1,file2,file3,... Create multiple files at the same time

Rm

remove

deleting files

RM File1,file2,file3,... Delete multiple files at the same time

Rm–rf a delete all directories under the A directory ( forced Delete, multi-branch, not recommended )

Wildcard *, match any length, any character

Cp

copy files and directories

CP src.c a / copy src.c to a /

CP src.c A/src.bak copies src.c to A/ and renamed to Src.bak

Mv

Move (rename) files

Implement a file or directory to move or change names

MV Src.c.bak src.c renaming src.c.bak under current directory to src.c

MV A src renaming the A directory under the current directory to SRC

MV src/a obj renames the A directory under src to obj and moves to the current directory

MV src/a src/obj Rename the A directory under src to obj

MV SRC.C b/To move the SRC.C under the current directory to b/



Three text editing commands

Gedit

graphical, similar to Notepad, WordPad under Windows

a.c~ with Tilde is a temporary swap file that can be used to restore the contents of the previous version of the edits

Ed

Unix older text editor

Ed A.C

Show Text Size First

A add content

. Stop adding

W Save

Q Exit


Nano

Linux Relatively small text editor

Ctrl o Save

Ctrl x Exit



Cat

Cat Source.list Prints the contents of source.list in the current directory to the screen

Cat/etc/apt/source.list to print soutce.list content from etc under Apt directory to the screen

Tac

Reverse ( line Reverse ) Print text content to screen

TAC A.C

Head

Head A.C Print first line ( default )

Head–n 3 A.C Print the first 3 lines

Tail

Tail a.c Print tail line ( default )

Tail–n 3 a.c print tail 3 lines

More

Split screen Printing

More/etc/apt/source.list Sub-screen printing etc under apt directory source.list text content

Space page

Less

Split screen Printing

Less/etc/apt/source.list Sub-screen printing etc under apt directory source.list text content

Ctrl F Page forward

Ctrl b Page Backward

Tar

File Packaging and Decompression

TAR–CVF Ab.tar A B creates a Ab.tar package in the current directory , containing a and b

-C Create a package file

V Show Package process

F must, without any meaning

TAR–XVF Ab.tar in the current directory Ab.tar

TAR–TVF Ab.tar See What's in Ab.tar

TAR–XVF Ab.tar A only unpack a in the bag

-C Change the decompression path

TAR–XVF ab.tar–c ss/ Extract the contents of the Ab.tar into the specified directory SS

History

View previously used command history



Compression and decompression

Gzip/gunzip

Bzip2/bunzip2

Tar–zcvf/tar-jcvf

Gzip/gunzip

Gzip Ab.tar Compression generated ab.tar.gz,ab.tar gone.

Gunzip ab.tar.gz

Bzip2/bunzip2

bZIP Ab.tar Compression generated ab.tar.bz2,ab.tar .

Bunzip ab.tar.bz2

Tar–zcvf,tar–jcvf/tar–zxvf,tar–jxvf

TAR–ZCVF ab.tar.gz Ab.tar will Ab.tar compression generation ab.tar.gz,ab.tar reserved

TAR–JCVF ab.tar.bz2 Ab.tar will Ab.tar compression generation ab.tar.bz2,ab.tar reserved

TAR–ZXVF ab.tar.gz will ab.tar.gz decompression generated ab.tar/ one step decompression

TAR–JXVF ab.tar.bz2 will ab.tar.bz2 decompression generated ab.tar/ one step decompression

TAR–ZXVF ab.tar.gz A B is created in step one . tar.gz

TAR–ZXVF ab.tar.bz2 A B is created in step one . tar.bz2



which

Find the location of the executable file

which LS

which PWD

which which

Whereis

Locating binary files, source files, help documents

Whereis–m ls query The location of the help document for ls

whereis–m pwd to find the location of the Help document for pwd

Locate

Querying the files in the database is faster than scanning the disk

sudo updated manually update the database ( not updated in real time, usually at night for a process update )

Locate ab.tar.gz

Find

Full Scan, similar to Windows Search

Find/-name ' af* ' in the current directory look for a file with the name beginning with AF


This article is from the "Learning" blog, so be sure to keep this source http://learnwithme.blog.51cto.com/7148047/1440459

Linux Basic Commands Learning notes

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.