Basic commands for 100 common Linux:
Posts-137, Articles-0, Comments-14
Hunter's homeland
Linux Learning notes: Common 100 commands (i)
2016-05-02 15:00 by Hunter Homeland, 837 reading, 0 reviews, Favorites, compilation
Linux Common commands
1. Shut down the machine
Shutdown-h now immediately shuts down the machine
Poweroff
Shutdown-r now reboot
Reboot
Logout logoff
2. Enter the graphical interface
StartX
3, VI Editor
[VI] [path]/[file];
[I] Enter the editing mode;
[ESC] Enter command mode;
[: Wq] Save and exit; [: q!] Exit does not save.
4. Display list
LS List
Ls-l detailed list Long table format
Ls-a Show hidden files
ll detailed list
Ls-l/bin/*sh file in the bin directory with the end of SH
5. Compiling Java files (Java, C, C + + programs can be developed)
Javac Hello.java
6. Running Java programs
Java Hello
7. Compiling C, C + + programs
Gcc-o Hello hello.c
Gcc-o Hello Hello.cpp
8. Run C, C + + programs
./hello.out
9. Linux Directory description
Root: The file that holds the root user
Home: Files for ordinary users
Bin: Store Common commands
Sbin: Commands that you want to have permission to access
MNT: The directory where the CD-ROM and floppy drive is mounted
ETC: Store configuration-related files
var: Storing files that change frequently
Boot: Store boot-related files
USR: default installation folder for software (like program Files for Windows)
10. Display the current path
Pwd
11. Add Users
Useradd xiaoming
12. Set the password
passwd xiaoming
13. Delete Users
Userdel xiaoming
14. Delete User and User directory
Userdel-r xiaoming
15. Command Run Level
0: Turn off the machine
1: Single User
2: Multi-user status No NETWORK service
3: Network Service with multi-user status (common)
4: System not used reserved to user
5: Graphical Interface (Common)
6: Restart the system
Configuration files:/etc/inittab--Id:5:initdefault
16, modify the method of error configuration
Press [E] while booting the interface;
Select Line 2nd and enter [E];
In the last input [space][1]--> stands for level 1th, single user level.
Press [b]--> to restart
17. Switch directories
Cd
18. Create a Directory
Mkdir
19. Delete Empty Directory
RmDir
RM-RF Delete a non-empty directory
20. Create an empty file
Touch
21. Copy command
Cp
CP mys*/Home Copy all files beginning with Mys
Cp-r recursive replication
Cp-rf don't ask, cover all
22. Move or change the file name
Mv
23. Delete Files or directories
Rm
Rm-rf
24. Establish a symbolic connection (equivalent to a shortcut in Windows)
ln
25, display the contents of the file with pagination (space is the next page, Ctrl+pageup previous page)
More
Less
26. Search for content in text
Grep
Grep-n "Hello" [Path]/[file]
| 27. Pipe command (equivalent to and, give the result of the previous command | to
subsequent command processing) |
28. Help (equivalent to Dos)
Mans
29. Search for files and directories
Find
Find/-name Hello.java
Find/-size +10000000k
FIND/HOME-AMIN-10 files or directories accessed within 10 minutes
FIND/HOME-ATIME-10 files or directories accessed within 10 hours
FIND/HOME-CMIN-10 files or directories that change within 10 hours
Find/home-ctime +10 10 hours ago changed file or directory
30. REDIRECT Command
Ls-l > Abc.txt Write content to Abc.txt
Ls-al >> Abc.txt Append the content to the end of the file Abc.txt
Grep-n "Hello" [Path]/[file] > Abc.txt Save Find results to Abc.txt
31. Adding user groups
Groupadd
32. View group Information
Vi/etc/group
Cat/etc/group (just view)
33. Create users and specify user groups
Useradd-g Police Xiaohong
34. View all user Information
Vi/etc/password
Cat/etc/password
35. File Permissions
-rw-r--r--
- Representative file type:-Normal file
The owner of the rw-file has permission to the file: R (4) readable, W (2) writable, X (1) Executable permission
r--file permissions for the same group as the
r--other users ' permissions on the file
36. Modify File access rights
chmod 777 Xiaoming
37, you can let Xiaohong modify the Xiaoming file
chmod 664 Hello.java
38. Change user Group
USERMOD-G Group name User name
39. Mount the image first specify a mirror for the virtual machine's CD-ROM
mount/mnt/cdrom/
mount/dev/sda1/test/#将sda1盘挂载到test目录下.
40. Unmount the image
umount/mnt/cdrom/
41, run in the background mode
./eclipse &
42. Eclipse runs, first configure Tomcat, and then configure the JDK.
43. View disk Usage
DF [Parameter]
Df-l
Df-h
44. See which partition a directory is in
DF [Directory full path]
df/boot/
45. View Linux system partition details
Fdisk-l
/dev/sda1 .....
Dev Device Name
SD SCSI Hard Drive (there is also an IDE hard disk, such as: hda1, meaning the same. )
A number of plates
1 The first few partitions
46, display the current operating system environment variables
Env
47. Change the shell input mode
Chsh-s/bin/csh
48. Shell command complement function
Direct input "MK"--and then press the "tab" key--there are two letters "MK" at both ends of the command.
Enter "Cat P" directly--and then press the "tab" key--all files or directories with the switch letter "P" appear.
49. Check the history command or the most recently executed command
History
History 10 recently executed 10 commands
!5 perform a command with a history number of 5
!ls the last command to start with LS
50, TCP, Ip
Application Layer--Transport layer-->IP layer--and link layer
How are you doing! ==>app_ Hello ==>tcp_app_ Hello ==>ip_tcp_app_ hello ==> frame head _ip_tcp_app_ Hello ==> nic ==> routing
51, SSL encryption (there are MD5 encryption, AES, Des and many other)
52. Trace Routing Commands
Tracert www.baidu.com
Traceroute www.baidu.com?
Route #显示路由表
53. Configure the Network
Setup
/etc/rc.d/init.d/network Restart #重启网络服务
54, in Linux, all the devices are files.
55, Windows and Linux interconnection, in the virtual machine's "configuration" to set the use of which network card.
56. How to check which RPM software is installed in Linux
Rpm-qa
57. Check whether the software is installed
Rpm-q MySQL
58. Query Package Information
Rpm-qi MySQL
59. Query the files in the package
RPM-QL MySQL
60. Query the package to which the file belongs
RPM-QF MySQL
61, the query package information on the software introduction
RPM-QP MySQL
62. Install RPM Package
RPM-IVH MySQL
I-install Installation
V-verbose Tips
H-hash progress bar
63. Delete RPM Package
RPM-E MySQL
64. Upgrade rpm
Rpm-u MySQL
65. Samba windows and Linux share files.
66. Remove software and dependency packages
--nodeps
RPM-E--nodeps MySQL
67. Service Start stop
Service MySQL Start/stop/restart
68. Install Samba
69, Process: ongoing procedures.
70. Viewing system processes
Ps-aux
A-all process information for the current terminal
U-Display process information in user format
X-Show parameters that the background process is running
80. Terminate the process
Kill terminates a process
Killall terminate the process and its child processes
81. Monitor process changes under Linux
Top
Top-d #每10秒刷新一次
U Monitor A user
Q exit (Ctrl + C)
82. Display system time
Date
83. Set the system time
Date Mmddhhmmccyy. SS month, day and day are divided annually. seconds seconds
84. View Calendar
Cal 4 2015
85. View Annual Calendar
Cal 2015
86. Monitor network status
Netstat
Netstat-an
NETSTAT-ANP (and show process number)
Monitor to ip--> find related process-->killall-9 1840 (process number) to kill
87. Detect host connection commands like Windows
Ping
88, MySQL (1) Free (2) cross-platform (3) light (4) support multiple concurrency
89. Initialize MySQL Database
script/mysql_install_db--user=mysql
90. Modify the owner of the file
Chown-r Root. (. Represents the current folder,-R means recursion)
Chown-r Root data (modifies the owner of the date folder)
91. Modify user Groups
Chgrp-r MySQL.
92. Start MySQL
Bin/mysqld_safe--user=mysql & (start in the background)
93. How to access the MySQL interface
./mysql-u-root-p
94, how to increase the MySQL path. bash_profile
Cd/root
VI. bash_profile
Add/home/mysql/bin to Path
95, the magic of SSH, a set of remote operation and upload, download files software. (also putty, WinSCP)
96, the user login program from the start command placed in the/ROOT/ETC/.BASHRC can be.
97. Temporarily load a path
Export Path= ...
98. Output command
Echo
99. Wildcard characters, escape characters, etc.
100, if a command is very long, and often used, then you can take an alias:
Alias
Alias Llh= ' ls-l/home '
Attached: Linux boot process analysis
(1) BIOS self-test
(2) Start crub/lil0
(3) Run the Linux kernel and check the hardware
(4) The first process of running the system init
(5) Init reads information from the system boot configuration file/etc/inittab
(6)/etc/rc.d/rd.sysinit system init script
(7)/etc/rc.d/rcx.d/[ks]* Configuration service based on RunLevel X
Terminates a service beginning with K, and starts a service with S.
(8)/etc/rc.d/rc.local perform local special configuration
(9) Other special services
Summary of Linux basic commands