Use of basic Linux commands (most basic)

Source: Internet
Author: User
Tags create directory

A few days ago learned the basic Linux commands, here to share, as a summary.

Environment: 192.168.54.242
Cd:
CD-Switch to the first use path;
Cd.. Go to Parent Path
CD ~ Enter into the root/directory
CD Ibid.
Cd.. /Relative Directory

Mkdir:
mkdir a Create directory A
Mkdir-p a/b/c Creating a tree Directory
MKDIR-M 777 A Create directory A and give maximum permissions
Mkdir-m a=rwx a ibid.
(About permissions: Rwx refers to: Read,write,execute, common permissions corresponding to the permission value: Rwxrwxrwx 777,rwx--x--x 711, Rwxr-xr-x 755)
Mkdir-v-M a=---d Create directory D and give minimum permissions (amount ... ) and display the information when it is created

RmDir: Delete Empty directory
RmDir a Delete empty directory A,a directory must be empty
Rmdir-p d/e/f Delete the tree directory, if each directory is empty

ls: commonly used-LA,-LH,
LS lists the files in the current directory, sorted by list
ls/var/www/html list files in the specified directory
LS-A lists all the files, including hidden and.
Ls-a list all files, including hidden
ls-d * * List all directories
(Description-D: Lists only the current directory itself, not the archive data in the directory)
ls-d */*/Lists all directories in the next directory
Ls-f directly lists files without sorting the files, including hidden and.
Ls-f plus the file type indicator symbol */=|, respectively: executable file, directory, socket file, FIFO file
Ls-l Details Display: Permissions, user, group, size, time and other information
Ls-n Details Display: UID, GID, group, size, time and other information
Ls-h-l-h and-L are used simultaneously to output file sizes in an easy-to-read format (e.g. 1K 234M 2G)
Ls-i list Inode numbers
LS-R outputs the result in reverse
Ls-r current directory and subdirectories are displayed together
Ls-s sorted by capacity size
Ls-t Sort by Time

Date
Date Displays the current time
date-d 16-5-30 Display specified time
Date-r 33.png shows the last modified time for file
Date-s "17:50:03 2016-05-31" set Date and time
Date-s 12:23:23 set a specific time, no changes are made to the date
Date-s 20061010 Set Month day, the specific time will be set to empty 00:00:00
Date-u Show or set global Time (GMT)
Date +%y-%m-%d displays month and day in this format
The date "+%y-%m-%d%h:%m:%s" outputs the specific implementation in this format (HMS must be uppercase)

Cal
Cal View current Month calendar
CAL-1 View calendar within one months
Cal-2 View calendar within three months
Cal-m viewing the calendar starts in Monday
Cal-s viewing the calendar starts in Sunday
Cal-y View calendar for a full year

Find: Find a specific profile
Find finds all of the current directory

FIND/HOME-NEWER/HOME/TEMP/TST Search by time, look for files under the new/home/temp/under the TST file
Find. -mtime +5 Search by Time, find the current directory 5 days ago modified,-within, + represents the previous
Find. -mmin-5 Search by Time, find the current directory within 5 minutes of the modified

Find. -name "*ma*" query by name to find files containing MA in the current directory
Find. -name "*.png"-print query by name to find the. png file in the current directory (case-sensitive, such as JPG and JPG are not the same)
Find ~-name "[0-9]*.png" lookup by name, look for a. png file that begins with a number in the root directory ([0-9] represents only one digit)
Find. Money-name "[0-9]*.png" ibid., look for hidden directories. Money under

Find. -perm 755-name "i*" search by permission, find the current directory under the permissions of 755, the name of the file beginning with I

Find. -type d Search by type, find directory (b device file; d directory; C character device file; p pipeline file; l symbolic link file; f normal file; s socket file)
Find. ! -type d Find by type, find non-directory

Find. -nouser/nogroup search by the owning user/user group to find files without attribution
Find. -user Root-group Root Search by the owning user/user group, find the file belonging to root user, root user group

Find. -size +1000b by size, + means greater than,-indicates less than, B represents bytes, c denotes character, default is block, piece =512b
Grep:
Ps:
Netstat: Display network connection, routing table, interface status, spoofing connection, network link information and multicast member group
Netstat displays the open socket. If no address family is specified, a valid socket for all configured address families is printed
Netstat-r Show kernel routing table, r refers to route
NETSTAT-G displays IGMP multicast group membership information for IPV4 and IPV6, G refers to groups
Netstat-i Show list of all network interfaces
NETSTAT-S displays statistics for each protocol (IP, ICMP, TCP, UDP, etc.), s refers to statistics
Netstat-c 3 will allow Netstat to continuously output the selected information every 3 seconds
netstat-a | More list all ports (including listening and not listening)
Netstat-at List all TCP ports
Netstat-au List all UDP ports
NETSTAT-TPNL See the connected TCP port, and the PID. (t refers to tcp,p refers to Pid,n refers to the digital form of the address, l refers to only the socket that is listening)
NETSTAT-ANP | grep 3306-c View the number of connections to the 3306 (MySQL) port
Netstat-alp | grep 8080 finds the process running on the specified port

Top: Displays information about the processes currently being executed by the system, including process ID, memory usage, CPU utilization, etc.
Top-b displaying program information in batch mode
Top-c Display full
Top-s Display in cumulative mode
Top-u Root Specify User name
Top-p 10 Specifies the process number display
Top-n 3 cycles displayed, updated to show 3 times after stop

The following is a description of the result information for top:
PID Process ID
PPID Parent Process ID
Ruser Real User Name
User ID of the UID process owner
Username of user Process Owner
Group Process Owner's name
PR-Priority
NI nice value. Negative values indicate high priority, positive values indicate low priority
%cpu percentage of CPU time that was last updated to current
The total CPU time, in seconds, used by the duration process
Total CPU time used by the time+ process, Unit 1/100 sec
Percentage of physical memory used by the%MEM process
The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res
The swap process uses the amount of virtual memory that is swapped out, in kilobytes.
The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data
The amount of physical memory the code executable consumes, in kilobytes per kb
The amount of physical memory that is used outside the data executable code (segment + stack), in kilobytes
SHR shared memory size, in kilobytes
Nflt Number of page faults
NDRT the number of pages that were modified the last time it was written to.
S process state.
d= non-disruptive sleep state
R= Run
S= Sleep
t= Tracking/Stopping
z= Zombie Process
Command name/command line


Free: Displays system usage and idle memory conditions, including physical memory, interactive area memory (swap), and kernel buffer memory
Free-b display memory units in bytes
Free-k display memory in kilobytes (default is KB)
FREE-M display memory in units of M
Free-o Ignoring buffer throttling columns
Free-t Sum information
Free-s 3 Executes a command every 3 seconds in s
Free-h display capacity in readable form, requires free-v display version greater than 3.3
Free-v version information (in uppercase V)


VIM uses:
See: http://www.cnblogs.com/softwaretesting/archive/2011/07/12/2104435.html
Vim Test.txt Open file (created and opened if the file does not exist)
Vim mode:
1. General mode enter by ESC or ctrl+[
2. Edit mode in general mode by: i/i o/o a/a Enter
3. The visual mode is entered in normal mode through V/A
Vim test1.txt test2.html open multiple files simultaneously
: bn switch to the previous file
: BP switches to the next file
: Open Test4.txt opens a new file in the current Vim window
: Args to view the currently open file, [] in the file being edited
/text find text, press N to find the next, press N to find the previous one.
? text Ibid. to find hidden directories
x Delete the current character. Dl=x
3x Delete current cursor start backward three characters
X deletes the previous character of the current character. X=dh
DD Delete When moving forward
DJ Delete Previous Line
DK Delete Next Line
10d deletes 10 rows from the beginning of the current line.
D Delete the current character to the end of the line. d=d$
: Wq Save and exit
ZZ Save and exit
: q! Force exit and Ignore all changes
: e! Discard all changes and open the original file.

This article is from "MySpace" blog, please make sure to keep this source http://wangzhaoli.blog.51cto.com/7607113/1785686

Use of basic Linux commands (most basic)

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.