Pwd # print working directory displays the current working directory
Touch # create an empty file
Mkdir # make directories
Cp # copy a file or folder
-R # recursive replication recursive
Mv # move a file or rename it
Mv [src File/Dir] [dist File/Dir]
Rm # romove
-R # recursive deletion
Cat # display file content
More # display file content by page
Head # view the first n rows of a file
Tail # view the last few lines of a file
Ln # generate a connection file
Ln-s [src] [dist] # Create a soft link
Permission management commands
Chmod # change the permissions mode of a file
Chmod [{ugo} {+-=}{ rwx}] [file/dir]
Chmod [mode = 421] [file/dir]
File permission:
File Directory
--------------------------------------------------------------
R read can view the file content and list the directory content
W write can modify the file content and create and delete files in the directory
X eXecute can eXecute files to enter the Directory
Chown # change file ownership
Chown [newOwner] [file | dir]
Chown well file1 # change the owner of file1 to be user well
-J. use bzip2 to compress/decompress
-Z'S support for gzip compression and decompression
-V display process
-C. create a package file
-X unpack and decompress files
-F filename: specifies the file name to be processed
-C dir indicates decompression in a specific directory
Network Communication commands
Write # Send a message to another user, ctrl + d as the end
Wall [message] [file] # broadcast messages to all users
Ping IP_ADDR # test network connectivity
Ifconfig # View network settings
-A # View all Nic information
Setup # set network information
System shutdown command
Shutdown-h now # immediate shutdown command
MPs queue:
| # Use the output of one command as the input of another command
Text editor Vim/Vi
Three modes:
Command mode
Insert mode
Edit mode
Insert command:
A attaches text behind the cursor
A adds text at the end of the line
I insert text before the cursor
I. start inserting text in this row
O insert a new line under the cursor
O insert a new line to the cursor
Positioning command:
$ Move to the end of the row
0 move to the beginning of the row
: Setnu
: Setnonu cancel row number
Gg to the first line
G to the last line
NG to n
: N to row n
Delete command:
Dd deletes the row where the cursor is located.
Ndd delete row n
: N1, n2d delete rows in the specified range
Copy and cut commands:
Yy and Y copy the current row
Cancel command:
U cancel the previous operation
Search and replace commands:
/String forward search for a specified string
N searches for the next occurrence location of a specified string
: % S/old/new/g replace the specified string in full text
Command for saving and exiting:
: W save changes
: Wq: save the modification and exit.
: Q! Exit without saving changes
Analysis of Linux boot process
Linux Software Package management
Binary package management (RPM, YUM)
For example there is a software package: sudo-1.7.2p1-5.el5.i386.rpm
Uninstall:
Rpm-e sudo
Installation:
Rpm-ivh sudo-1.7.2p1-5.el5.i386.rpm
Upgrade:
Rpm-Uvh sudo-1.8p1-5.el5.i386.rpm
----
Benefits of yum: automatically solves software package dependencies and facilitates software package upgrades
Install: yum install
Detection Upgrade: yum check-update
Upgrade: yum update
Package query: yum list
Package Information: yum info
Uninstall: yum remove
Help: yum-help, man yum
Source code package installation
Example: proftpd
Tar-xzvf proftpd-1.3.3d.tar.gz (unzipping)
Cd proftpd-1.3.3d
./Configure -- prefix =/usr/local/proftpd (configuration)
Make (compilation)
Make install (installation)
Script installation (shell, java script)
./Setup. sh
Password file/etc/shadow
User group file/etc/group
User type
Root User, UID = 0
Common user, UID = 500-60000
Pseudo-user, UID = 1-499
Pseudo users are related to systems and program services, such as bin, daemon, shutdown, halt, and mail, new, games, apache, and ftp.
Pseudo users do not usually need to or cannot log on to the system; they can have no home directory
Add user
Useradd NEW_USERNAME
Passwd NEW_USERNAME # set password
Linux process management
View user information w
JSCPU is distinguished by terminal code. the CPU time consumed when all related processes of the terminal are executed.
Pcpu cpu execution time
WHAT operations are being performed by the user?
View individual user information w USERNAME
View process ps in the system
A. display the processes of all users.
U display user name and start time
L Long Format Display
PID process number
The process ID of the parent PPID process.
TTY process start terminal
Current state of the STAT process (S sleep state, D sleep state that cannot be interrupted, R running state, Z dead state, T stopped)
NI process priority
Ex.
# Ps view processes belonging to you
# Ps-u or-l view detailed information of a subordinate process
# Ps-le or-aux
# Ps-aux -- sort pid can sort processes by execution time, PID, UID, etc.
Kill process shutdown
Kill PID
Linux file system management
Common file system folders:
/Usr/bin stores commands that can be executed by all users
/Usr/sbin stores commands that only the root user can execute.
/Usr stores all commands, libraries, and manuals
/Etc system configuration file
View disk information
Df view partition usage
View the file and directory size in du
Fsck detects and repairs the file system
E2fsck
Add hard disk partition
Fdisk partitioning
Create a file system using mkfs
Mount try mounting
/Etc/fstab write configuration file
Shell Programming
Shell structure:
1 .#! Specifies the shell for executing the script
2. # Comment rows
3. command and control structure
To create a shell program:
Step 1: Create a file that contains commands and control structures.
Step 2: modify the permission of the file so that it can execute
Use chmod u + x
Step 3: Execute./example
(You can also use "sh example" for execution)
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.