Linux common system commands and file operations

Source: Internet
Author: User

First, Linux common file operations

    (1) CD/: The Slash "/" in the Linux system represents the root directory. CD/, enter the root directory.

(2) CD ~ command is to enter the user's home directory in the system, such as XZ user, then enter the/ROOT/XZ directory

(3) LS: Used to list files in the directory

-L: View more information

-A: View all files, including hidden

Man:linux help commands, such as man ls

(4) mkdir: Create a directory

mkdir Kai: The current path is created with the name Kai directory

mkdir./kai/test.txt: Test.txt file created under the current path Kai directory

(5) CD: Switch directory

CD./java: Enter subdirectories of the current directory

Cd.. /java: A subdirectory into the previous level directory

(6) Touch: Create a blank plain file

(7) Echo: Redirect content to the specified file, redirect if none, implicitly create and re-redirect

Overlay mode: echo "Fuck" >haha.txt

Append mode: echo "Fuck" >>haha.txt

(8) Cat,more: View file contents

Cat: View File contents

MORE: Paging to view the contents of the file, space bar to change pages

(9) Cp,mv,rm:

CP: Copy file CP Demo.java./kk/

MV: Cut

Rename: Add cut and Store is the file in the same directory, is renamed MV Haha.txt Hehe.txt

RM: Delete files or folders

-F: The file to be deleted does not exist and does not prompt

-I: To prompt before deletion, delete input y by default

-D: Delete empty directory

-R: Recursive delete

(one) Wc:word count of statistics characters

Three numbers represent: number of lines, number of words, number of characters

LN: The connection creates a file, like a copy, but the content modification of two files is synchronized.

The changes made to the connection name AAA file after ln haha.txt aaa:ln file name Connection name are synchronized to the Haha.txt file

PWD: View the absolute path to the current directory

LA: Pipeline command

The output of the preceding command, as input to the following command, such as Ls-la | Wc

       

(passwd): Set password, ubuntu default password wood is on, need to set root password need to use the command sudo passwd root

(+) SU: switch account su root

Second, Linux common system commands

    (1) Stat: View detailed information about a file

(2) Who: View online users

(3) WhoAmI: View the current user

(4) Cat:cat the normal file name, will print the contents of the document to the screen

(5) Uname: Display System Information

(6) Uname-a: Display Complete System Information

(7) Top: Shows the current time-consuming process information, not 3 seconds to refresh, you can use CTRL + C interrupt

(8) Kill: Kill Process (Kill PID)

(9) Echo $LANG: Viewing the system character set

Ps-axu: Displays a snapshot of the current process

Du: Displays the size information of the directory

DF: View disk usage

(ifconfig): View network card information

Ifconfig: View or configure NIC information, like Windows ipconfig

ipv4:32 bit 2-32 IPv6 128 bits is IPv4 2-96 Times Square

Ping: Test connection to target host

(netstat): Network connection details

(+) Useradd: View user Information

sudo cat/etc/passwd
Itcast:x:1000:1000:ubuntua,,,:/home/itcast:/bin/bash
-Itcast: User name
-X: Password: Encrypted, password stored in/etc/shadow
-1000: Account ID, userId
-1000: Group ID, Team ID
-Ubuntua,,,: Account description
-/home/itcast: The default location of the file to which the account is stored ~
-/bin/bash: How the user's shell script is parsed, SH, bash, Rbash

-Create User

sudo useradd lijun-d/home/lijun-s/bin/bash
-D: Specify the user's home path
-S: Shell parsing method for this user
Steps:
1. Create a/home/lijun directory
2. Execute useradd command
3. Set the password with passwd
4. Su Switch User

Third, other

    (1) Logout: Logout

(2) Exit: Exit

(3) Shutdown: shutdown–h time

-H: Shutdown

Time: Now: 12:30: Specify time 3: After a few minutes

Note: Sudo:super user do (which is executed by the superuser), such as permissions to shut down, not all users can perform shutdown operations, must be licensed by Su, and the authorization file is located in/etc/sudoers, which is used to configure which users can execute which commands

(4) Restart: shutdown–r time

-r:restart

Linux common system commands and file operations

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.