Explain what is GPL,GNU, free software?
GPL: (general Public License): A power to grant, modify, and redistribute free software to any person.
GNU: (Slave program): The goal is to create a completely free and open operating system.
Free software: A software that can be freely used, copied, researched, modified and distributed without restriction. Main license has GPL and BSD license two
Two
Linux system composition: Kernel + Peripheral Program
Uname-r
Default:
[Current user @ host working directory]#/$
Can change
$PS 1
[Email protected] ~]# echo $PS 1
[\[email protected]\h \w]\$
You have new mail in/var/spool/mail/root
[Email protected] ~]# ps1= ' \[email protected]\t \$ '
[Email protected]:43:15 #
[Email protected]:43:16 #
#man Bash
Internal command: Part of the shell program that resides in the kernel when the system starts
External command: Not in Shell program, its command procedure is controlled by shell
[[Email protected] Desktop]# type ls
LS is aliased to ' LS--color=auto '
[[Email protected] Desktop]# type cd
CD is a shell builtin
[[Email protected] Desktop]# which LS
Alias ls= ' ls--color=auto '
/bin/ls
[[Email protected] Desktop]# which CD
/usr/bin/which:no CD in (/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin)
[[Email protected] Desktop]# enable are internal commands
Enable.
Enable:
Enable [
Enable Alias
Touch create file and update timestamp
Stat View file Status
[Email protected] ~]# stat 1.TXTT
File: "1.txtt"
size:19 blocks:8 IO block:4096 Normal file
device:802h/2050d inode:10618267 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2017-04-05 10:31:05.094196869 +0800
modify:2017-04-05 10:31:30.275196833 +0800
change:2017-04-05 10:31:30.275196833 +0800
[[email protected] ~]# Touch 1.txtt
[email protected] ~]# cat 1.txtt
123456
1sdafafasdf
[Email protected] ~]# stat 1.TXTT
File: "1.txtt"
size:19 blocks:8 IO block:4096 Normal file
device:802h/2050d inode:10618267 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2017-04-05 10:34:12.915295258 +0800
modify:2017-04-05 10:34:06.731295266 +0800
change:2017-04-05 10:34:06.731295266 +0800
[Email protected] ~]# echo 1212 >>1.txtt
[Email protected] ~]# stat 1.TXTT
File: "1.txtt"
size:24 blocks:8 IO block:4096 Normal file
device:802h/2050d inode:10618267 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2017-04-05 10:34:12.915295258 +0800
modify:2017-04-05 10:37:34.476433508 +0800
change:2017-04-05 10:37:34.476433508 +0800
[[Email protected] ~]# TAC 1.TXTT
111
1212
1sdafafasdf
123456
[email protected] ~]# cat 1.txtt
123456
1sdafafasdf
1212
111
[Email protected] Desktop]# echo 111 >1.txt
[Email protected] Desktop]# cat 1.txt >b.txt
[Email protected] Desktop]# cat B.txt
111
Make a disc image
DD If=/dev/cdrom Of=rhel6.iso
Cp/dev/cdrom Rhel6.iso
Cat/dev/cdrom > Rehl6.iso
Cat merge Files
[Email protected] Desktop]# cat 1.txt
111
[Email protected] Desktop]# cat B.txt
1 111
[Email protected] Desktop]# cat 1.txt b.txt >new.txt
[Email protected] Desktop]# cat New.txt
111
1 111
[Email protected] Desktop]# cat 1.txt
111
Adasd
[[Email protected] Desktop]# tr ' A-Z ' A-Z ' <1.txt export
111
Adasd
[Email protected] Desktop]# echo 1212 >>1.txtt
[Email protected] Desktop]# ls-i 1.txtt
10749834 1.txtt
[Email protected] Desktop]# ln 1.txtt hello.txtt
[Email protected] Desktop]# ls-i hello.txtt
10749834 Hello.txtt
[Email protected] Desktop]# du-h 1.txtt
4.0K 1.txtt
[Email protected] Desktop]# du-h hello.txtt
4.0K Hello.txtt
[Email protected] Desktop]# md5sum 1.txtt
B5e808f2a41cb05f73fd604ab1b3bda6 1.txtt
You have new mail in/var/spool/mail/root
[Email protected] Desktop]# md5sum hello.txtt
B5e808f2a41cb05f73fd604ab1b3bda6 Hello.txtt
——————————
Two less than number
————————————
[Email protected] Desktop]# cat merepo.sh
#!/bin/bash
Cat <<eof >/etc/yum.repos.d/server.repo
[Server]
Name=server
baseurl=ftp://172.40.55.104
Enabled=1
Gpgcheck=0
Eof
[[Email protected] Desktop]# rm-fr/etc/yum.repos.d/*
[[Email protected] Desktop]# sh merepo.sh
[[Email protected] Desktop]# ls/etc/yum.repos.d/
Server.repo
[Email protected] Desktop]# yum repolist
Loaded plugins: Fastestmirror, Refresh-packagekit, security
Determining fastest Mirrors
Server | 4.1 KB 00:00
server/primary_db | 3.1 MB 00:00
Warehouse Identity Warehouse Name Status
Server server 3,819
repolist:3,819
——————————————————————————————
[[Email protected] Desktop]# ls-l $ (CAT/ETC/PASSWD)
[Email protected] Desktop]# cat/root |xargs ls-l
[[Email protected] Desktop]# egrep-n ' adm '/etc/passwd
4:adm:x:3:4:adm:/var/adm:/sbin/nologin
[[Email protected] Desktop]# egrep-n-b2-a3 ' adm '/etc/passwd
2-bin:x:1:1:bin:/bin:/sbin/nologin
3-daemon:x:2:2:daemon:/sbin:/sbin/nologin
4:adm:x:3:4:adm:/var/adm:/sbin/nologin
5-lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
6-sync:x:5:0:sync:/sbin:/bin/sync
7-shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
[[Email protected] Desktop]# egrep--color-o ' Var|dev '/etc/passwd
Var
Var
[[Email protected] Desktop]# grep--color root/etc/passwd
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
[[Email protected] Desktop]# grep--color-o root/etc/passwd
Root
Root
[Email protected] Desktop]# tar ACF security.tar.gz security
[[Email protected] Desktop]# find/tmp/clu-type f-exec chmod 644 {} \;
[[Email protected] Desktop]# find/tmp/clu-type d-exec chmod 750 {} \;
Command completion in VI:
Hostna
CTRL + N Ctrl+p
RPM Download
Http://rpmfind.net
Http://rpm.pbone.net
Http://mirrors.163.com
Http://mirrors.aliyun.com
Local RPM pack Yum: Dependencies can be automatically resolved
Yum-y Install li*.rpm
| ————————————————————————————————————————————————
The local Yum cache is done first, can be copied to a computer that cannot be networked, and the dependencies on the package can be used
[[Email protected] Desktop]# vim/etc/yum.conf
2 Cachedir=/tmp/mypacks
3 keepcache=1
[[email protected] desktop] #yum-y install System-config-kickstart
[[email protected] desktop] #ls/tmp/mypacks/server/packages/This yum-dependent copy will
————————————————————————————————————————————————
Architecture is not the same
YUM-RHN-PLUGIN-0.9.1-58.EL6.NOARCH.RPM can All
ZLIB-DEVEL-1.2.3-29.EL6.I686.RPM 32-bit
ZLIB-DEVEL-1.2.3-29.EL6.X86_64.RPM 64-bit
Create user Default Profile
[[email protected] desktop] #vim/etc/login.defs
660 Uid_min
60000 Uid_max
[[Email protected] Desktop]# useradd TT
[[Email protected] Desktop]# ID TT
uid=660 (TT) gid=660 (TT) group =660 (TT)
/etc/skel
/etc/passwd/etc/shadow
/etc/group/etc/gshadow
[Email protected] Desktop]useradd-u 555 Zhangsan
[[email protected] desktop] #vim/root/.bash_history each exit command is written here
[[email protected] desktop] #vim/root/.bash_logout (Delete history command each time you exit)
# ~/.bash_logout
History-c
~
[[Email protected] Desktop]# chage-m bob (Specify password Max days,-m minimum number of days)
[[Email protected] Desktop]# chage-l bob lists password expiration information
[[Email protected] Desktop]# chage-e 20170605 Bob Specify account expiration time
[[Email protected] Desktop]# chage-d 0 Bob Password immediately expire use change password
[Email protected] ~]# echo "log-$ (date +%f). tar.gz"
Log-2017-04-05.tar.gz
If you import this private key information, you do not need to write gpgcheck=0
[Email protected] ~]# rpm--import ftp://172.40.55.104/RPM-GPG-KEY-redhat-release
——————————————————————————————————
Chmod-r u=rwx,g=rx,o=rx/tmp/ss (large x directory is 755, file 644)
[Email protected] ~]# chmod-r u=rwx,g=rx,o=rx/tmp/ss
[Email protected] ~]# ll-l/tmp/ss
Total dosage 16
Drwxr-xr-x. * Root root 12288 April 5 16:45 etc
-rw-r--r--. 1 root root 2031 April 5 16:44 passwd
————————————————————————————————————————
The command is run by the identity of the
SUID: command to Run command as owner U+s
[Email protected] ~]# chmod u+s/bin/ls
[Email protected] ~]# Ll/bin/ls
-rwsr-xr-x. 1 root root 117024 October 2014/bin/ls
[Email protected] ~]# Su-bob
[Email protected] ~]$ Ls/root
1.txtt
2.txt
——————————————————
[[Email protected] Desktop]# Su-bob
[[email protected] ~]$ Touch 1.txt
[[email protected] ~]# which touch
/bin/touch
You have new mail in/var/spool/mail/root
[Email protected] ~]# chmod U+s/bin/touch It's the same [[email protected] ~]# chmod 4755/bin/touch
[[email protected] ~]$ Touch 2.txt (this is created as root)
[Email protected] ~]$ LL-LHD 1.txt 2.txt
-rw-rw-r--. 1 Bob Bob 0 April 5 16:57 1.txt
-rw-rw-r--. 1 root Bob 0 April 5 16:57 2.txt
————————————————————————————————————————
Sgid: Inherit parent directory genus Group G+s
[Email protected] ~]# Mkdir/tmp/demo
[[email protected] ~]# chgrp Bob/tmp/demo are all the same chown:bob/tmp/demo
[Email protected] ~]# ll-d/tmp/demo
Drwxr-xr-x. 2 root Bob 4096 April 5 17:05/tmp/demo
[Email protected] ~]# Cp/etc/hosts/tmp/demo
[Email protected] ~]# Ll/tmp/demo
Total Dosage 4
-rw-r--r--. 1 root root 187 April 5 17:06 hosts
[[email protected] ~]# chmod G+s/tmp/demo After the directory has been added G+s permissions, the file in this directory is the user
[Email protected] ~]# ll-l/etc/passwd
-rw-r--r--. 1 root root 2031 April 5 15:48/etc/passwd
[Email protected] ~]# Cp/etc/passwd/tmp/demo
[Email protected] ~]# ll/tmp/demo/
Total Dosage 8
-rw-r--r--. 1 root root 187 April 5 17:06 hosts
-rw-r--r--. 1 root Bob 2031 April 5 17:07 passwd
Sticky bit: Users can only delete their own files
[[Email protected] Desktop]# setfacl-m u:bob:rwx rem_com.sh to a certain user to the file permission to stick shame bit
One sector 512 bytes
Mechanical Disk-----"SSD (Boot direct operation don't have to wait)
There are several ways to refresh after partitioning:
Partx-a/dev/sdb
Reboot
Higher swap performance in partitioned form even worse for files
So when you use it, you can give the partition swap and the file priority in/etc/fstab.
This article is from the "12336621" blog, please be sure to keep this source http://12346621.blog.51cto.com/12336621/1913140
Linux System Command Review