** Kernel and distribution
LInux itself is the kernel (kernel) of an operating system. Only the kernel cannot run, and a batch of corresponding applications need to be combined to form a collection, which is what we want. This aggregate is the distribution **
Such as Red Hat Redhat, ubuntu is a different distribution
Basic command:
1、ls
ls -l display list details
ls -a can display all files, including hidden files
ls -l -a
2、cd
Switch directory
cd . (to the current directory) eg: ./xx.sh Execute the sh file There is a xx.sh file in the current directory
cd .../ (upper layer)
cd
. Current directory
... Upper directory
— previous directory
/ root directory
~ Home directory of the former user (shortcut key
cd ~ for the home directory) (similar to the default storage space for documents, pictures and other files in Windows) Each user has a home directory, ordinary users are /home/username, root users Yes /root multi-user system
$ common user command line prompt
# root user command line prompt
observe the content of ls -la in the new directory
3. Absolute path (starting from the root directory), relative path (starting from the current directory) / 4. The current absolute path of
pwd /
5. mv to move the file (you can also rename it)
6. cp copy the file
cp -r copy folder
cp -f force
cp -rf
7. touch file
8. mkdir folder
mkdir -p abc/abc concatenation creates empty folders
9. rm file/folder deletion
rm -r delete folder
rm -f (force force delete)
10. rmdir can only delete empty folders
11. The cat file directly displays the file content on the command line
12. ln -s source file target connection file
Soft link, consistent connection, similar to Windows shortcut master-slave relationship
Hard link ln The equal relationship is different from copy, the essence is that there is only one file, similar to the death-free gold medal
13. man offline help manual
man 1 ls xxx linux command
man 2 ls xxx linux api
man 3 ls xxx c library function
14. apt-get install vim installation software
apt-get remove vim uninstall purge
ls -l
first character - dlp (pipeline file pipe) s (socket file)
15、they are root
Normal user switch to root user, need password
Switch between common users, need password
root Switch normal user without passwordSudo temporarily obtains root privileges and executes only one command without switching directories
16. Permission
d rwx rx rw-
前三个是属主对文件的操作权限
中间三个代表属主所在组的操作权限
后面三个代表其他组内的对文件的操作权限
r 可读 w 可写 x 可执行 -不可以
4 2 1
x不是想当然设置的,要看文件本身能不能运行!!!
17. Modify permissions:
(1) Directly change permissions chmod 744 file name
(2) Original basic addition and deletion permissions
owner u owner group g other o
chmod u+x file name
chmod gx file name
chown owner file name modify owner chgrp modify owner the group you are in
Advanced commands are not commonly used
1、find
Find files (hard disk search) find path -name When to use "'filename'" ? Generally know the file name, but do not know which path
2、grep
Find the content in the file, check a certain word grep -nr [option]
"word to search" file name
3、which 和whereis
Function to find a binary file (applications such as ls, vim, mkdir) The difference is which only displays the path of the binary file whereis
displays the path of the binary file, source code, man manual, etc., more detailed
4、unname
查看系统信息
uname -a
5. Shutdown -h now shut down immediately
shutdown -r now 立即重启
init 0 关机 init 2 重启
reboot 重启
6. tree (requires installation) to display the relationship structure of directory files
7. mount and unmount
挂载磁盘到文件系统
eg : mount -t nfs -o nolock ip:/root/path /mnt
eg: unmount /mnt
8. Disk space management
df -h 显示已挂载分区列表
du -h 显示文件或文件夹的大小
9. User management
useradd 张三 创建用户
userdel 张三 删除用户
passwd 张三 密码 设置张三用户密码
10. File packaging, compression and decompression
tar -czvf dir.tar.gz dir/
tar -cjvf dir.tar.bz2 dir/
tar -zxvf dir.tar.gz
tar -jxvf dir.tar.bz2
c 解压 x 打包
z gz方式 j bz2方式
d'affaires ******
-
Build a server to format the file system sed and awk
-
Network configuration Virtual machine Internet bridge mode NAT host only (only host mode)
NAT: 修改/etc/network/interfaces auto eth0下的inter static为dhcp 执行/etc/init.d/networking restart 重启网卡