Linux basic commands

Source: Internet
Author: User
Tags clear screen parent directory

Linux basic commands (all files)


Command format:
command [options] [parameters]


Note: Use spaces to separate commands, options, and parameters, most of which support only 256 characters.


Help
Man Handbook eg. Man Mans

Man command/Function name/header file


LS list content lists directory contents (WINDOWS:DR)
Ls-a Show all files (including hidden files, hidden files usually with '. ') Beginning
Ls-l Show file Details
Drwxrwxr-x 2 Tarena tarena 4096 April 11:10 Pre


--Ordinary files, storing data in a certain format (binary or text)
D: catalog file. B: Block device file, which provides buffer direction to the device. C: Character device file, without cache. P: Pipeline file, interprocess communication.
S:socket socket files, network communication between processes. L: Symbolic link file, pointing to another file (quite a shortcut under Windows).


Owner Genus GroupOther
Tarena Tarena Others
Rwx Rwx R-x


R:4 0100 Reads
W:2 0010 writes
X:1 0001 execution


Clear Clear Screen Ctrl + L (WINDOWS:CLS)


PWD Prints the current working directory


Switch directory for CD change directory
/: Root directory
./: Current directory
.. /: Previous level directory/parent Directory
~: The current user's home directory

1) Absolute path: The path to traverse from the root directory
2) Relative path: The path to traverse from the current directory

mkdir Creating a Folder


Touch create file, modify file last modified time


RM Delete File


Rm-r Deleting non-empty folders


RmDir Delete Empty folders


CP Copy Copy
CP file_name dir_name Copy files to the specified path
CP file_name Dir_name/newfile_name renamed or overwritten copy
Cp-r dir_name another_name Copy directory requires-R

Cp-all dir_name another_name Copy all content to the specified directory according to the original dependency


MV Move rename (rename)
MV File_name Dir_name
MV file_name Dir_name/newfile_name

MV file_name Newfile-name


chmod Modifying file permissions
CHMOD[U/G/O/A][+-=][R/W/X] FileName

=: Only one of the permissions is reserved, other deletions


Cat file_name Display file contents


Head file_name display the first 10 lines of file content

Head-n file_name See n rows


Tail file_name 10 lines after displaying the contents of the file


More file_name split screen display file contents

Blank: Flip One screen

Enter: Next line


History shows the commands that have been executed
!! Repeat the last command
!n repeating nth Row command

! First letter up search, last executed command


WC file Statistics
Statistics the number of bytes, characters, and lines of the file to be set up and displayed
WC [option] file_name
Wc-l file_name Display line number

Wc-w file_name Displays the number of characters in Word

wc-c file_name Display of bytes


; The end of a semicolon statement, typically used to link execution of multiple commands
| Pipe the output of the previous program or command as input to the next program or command
History | More
Users to see who is logged on to the system
Who logs on to the local system user details
Who am I displays information about the current user

WHOAMI display the name of the current user


Working status of PS detection process
-EShow All Processes
-F Show detailed process
-HDo not show title
ADisplays the programs running on the terminal
R To display a running process
X Show process without control terminal
U Show verbose format
Aux Show detailed information for all processes
Top
Kill PID ends the specified PID process
-9 Sigkill signal Force Kill program

redirect
> Truncate Write

>> Append write at end


File link
ln [options] source [dest]
ln [options] source [dest]
ln [options] Source...directory


Hard Links
ln [pathname]/[file name] [pathname]/hard-link name


Bash shortcut keys
CTRL + L Clear Screen
CTRL + a navigates to command start
CTRL + E navigates to the end of the command
CTRL + D exit, end command
CTRL + C Interrupt Program
CTRL + Z hangs the command you are executing
CTRL + SHIFT + C copy
CTRL + SHIFT + V paste

Linux basic commands

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.