Linux Common commands

Source: Internet
Author: User
Tags clear screen safe mode

commands for displaying directories and files

Ls: A command to view all folders.

Dir: command to display the specified folder and directory tree: List directory contents in a tree view

Du: Show directory or file size

Modify directories, file permissions, and host and array commands

Chmod: The permission command used to change the specified directory or file.

Chown: The command used to change the properties of a file.

CHGRP: The command used to change the file group.

Chattr: Used to set files with non-delete and modify permissions.

Lsattr: Used to display hidden properties of a file or directory.

commands for creating and deleting directories

Mkdir: Used to create a directory

Rmdir: Used to delete empty directories

Rm-f: Used to delete a directory that is not empty

Create and delete, rename, copy a file commands

Touch: Create a new file

Vi: Create a new file

Rm: Deleting files or directories

Mv: Commands to rename or move files

Cp: Copy command

SCP: Used to copy a local file or directory to a remote server

Wget: Used to download ftp or http server files locally.

Commands to display the contents of a file

Cat: Used to display the entire contents of a specified file

More: Displays the contents of the specified file in pagination

Less: Displays the contents of the specified file as a paging, with the difference between the more and less pages using the same key.

Head: Used to display the first n rows of the file .

Tail: Used to display the contents of the following n rows of a file .

Tail-f: The data content of the display file after n rows for auto-refresh .

Find command

Find: The command that finds the specified directory or file.

Whereis: Find the specified file source and binary files and manuals, etc.

Which: the location used to query for commands or aliases.

Locate: Quickly find the content specified in the system database .

Grep: Finds content that satisfies a condition within the specified file or standard output, standard input.

Commands to shut down and restart your computer

Shutdown:-R restarts immediately after shutdown

-K does not really shut down, but only sends a warning message to all users

-H does not restart after shutting down the machine

Poweroff: For power off and off

Init: Changing the operating level of the system

level 0 for shutting down the system

Level 1 for single user mode

Level 2 for Multi-user usage (but without network functionality)

Level 3 for Multi-user usage (with network full function)

Level 4 for user-defined usage patterns

Level 5 indicates the mode when entering x Windows

Level 6 to restart the system

Reboot: for computer restart

Halt: For shutting down a computer system

Compress and Package commands

Tar: Used to package multiple files or directories, but not compressed, and also unpacked with commands

Gzip: For file compression and decompression commands, the file name extension is end of . GZ .

Gunzip: Used to decompress the gzip compressed document.

BZIP2: Used to compress and decompress files or directories

Bzcat: Used to display the contents of a compressed file.

Compress/un Compress: Compression / decompression . Z File

Zcat: View Compressed file contents at the end of Z or GZ.

Gzexe: compressing executable files

Unarg: Extracting . Arj Files

Zip/unzip: compressing and decompressing . zip Files

User Action Commands

Su: Switch User command

Sudo: A system administrator's identity Execution command

PASSWD: Used to modify the user's password

Change directory and view current directory commands

Cd: Enter the working directory

Cd .. : It will go back to the previous level command

PWD: Displays the current user's working directory location

File connection command

Ln: Creates a connection for the source file and does not copy the source file, that is, it takes up a small amount of space.

Can be divided into software connections and hard links.

Soft Connect: Also known as symbolic Connection, a shortcut is created for a file or directory.

Hard link: Give a file more than one name, put in a different directory, easy for users to use.

The Ln command parameters are as follows:

-F: When creating a connection, delete the file or directory with the same name as the destination object first.

-D: Allows system administrators to hard-link their own directories.

-I: asks the user before deleting the file or directory with the same name as the destination object.

-N: Treats thedestination object as a generic file when creating a soft connection.

-S: Creates a soft connection, which is a symbolic connection.

-V: Displays the file or directory name before connecting.

-B: Files that will be overwritten or deleted at the time of connection are backed up.

Help Command-----Man

otherCommand

who: The display system has those users in use.

-ami Show Current user

-u: Show the user's actions / work

-S: Use a short format to display

-V: Show program version

Free: View memory usage of the current system

Uptime: Shows how long the system has been running

Ps: Show the dynamics of the instantaneous process

Pstree: Displays all the processes in the system in a tree-like manner

Date: Displays or sets the day and time of the system.

Last: Displays the user information of the monthly login system

Kill: kills some specific process

Logout: Exiting the system

Useradd/userdel: Add user / Delete user

Clear: Clear Screen

PASSWD: Set User password

VI Editor

First open a file with the VI command

Last-line mode command:

: N,m w path/filename Save specified range document ( n table Start Row,m table end row)

: q! force quit after making changes to the file

: Q No changes have been made to the file exit

Wq or x Save Exit

DD deletes the cursor in the row

: Set number Displays line numbers

: n jumps to n rows

: S replacement string: s/test/test2/g/g global replacement/can also be substituted with%

/Find String

Common commands for network communication

ARP: Network address display and control

FTP: File transfer

Lftp: File transfer

Mail: Send / receive e-mail

MESG: Allows or denies other users from sending information to the terminal they are using

Mutt e-mail management program

Ncftp : File transfer

Netstat: Displays the network connection . routing table and network interface information

Pine: Send and receive emails, browse newsgroups

Ping: To see if the network is connected smoothly

Ssh: Remote login in Safe mode

Telnet: Telnet

Talk: Talking to another user

Traceroute: Displays the path through which a host was reached and the time it was used.

Wget: Automatically download files from the Internet

Write: Writing information to other user terminals Rlogin: Telnet

Linux Common 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.