Linux Learning Note Two

Source: Internet
Author: User


(((((((() ((() ((() ((()))))))))) (((((())))))))))


-------------------------------------------------the list command-----------------------------------------------
Ls
List # #列出目标文件, or list content in a directory
-A # #列出所有 (contains hidden files)
-L # #列出文件属性
-S (--size) # #列出文件大小
-S # #按照文件大小排序
-R # #第归列出
-D # #指定目录本身
-LD # #列出当前目录的属性
----------------------------------------------------End--------------------------------------------------


-------------------------------------------------Order Review---------------------------------------------
ID Student —————————— >
CD ~student ———————— >pwd:/home/student (back to student home directory)
~username # #进入到指定用户家目录
.. # #进入当前目录的上一级
-# #进入之前所在系统目录
[Email protected] desktop]$ Cd/home
[[email protected] home]$ ls
Kiosk
[Email protected] home]$ CD.
[Email protected]/]$ CD-
/home
[Email protected] home]$ pwd
/home
[Email protected] home]$ CD ~
[Email protected] ~]$ pwd
/home/kiosk
[Email protected] ~]$ Cd/sys/bus
[Email protected] bus]$ pwd
/sys/bus
[Email protected] bus]$ CD ~kiosk
[Email protected] ~]$ pwd
/home/kiosk

----------------------------------------Simple to use----------------------------------------------------

[Email protected] ~]$ Cd/desktop
BASH:CD:/desktop:no such file or directory
[[Email protected] ~]$ CD Desktop
[email protected] desktop]$ touch files
[[email protected] desktop]$ mkdir-p aying/aying1/aying2 # #将几个目录嵌套建立, if no-p is not successful, because the first aying directory does not exist
--------------------------------
[email protected] desktop]$ Touch Files # #新建文件files
[Email protected] desktop]$ pwd
/home/kiosk/desktop
[email protected] desktop]$ CP files/
cp:missing destination file operand after ' files/'
Try ' CP--help ' for more information.
[email protected] desktop]$ CP files/deskop/
Cp:cannot stat ' files/': not a directory
[email protected] desktop]$ CP files Files1 # #将files复制为files1
[Email protected] desktop]$ mkdir Redhat # #建立一个目录redhat
[email protected] desktop]$ CP redhat/westos/
cp:omitting directory ' redhat/'
[[email protected] desktop]$ cp-r redhat/westos/# #将redhat复制到westos目录下, you have to have-R.

-------------------------------------------End--------------------------------------------------



-----------------------------man (Not men ——。 --) Command----------------------------------
Man--->manual (manual)
Man 1 passwd # #其中的1可以省略 because the 1+ parameter equals the parameter
Man 5 passwd # #查看系统文件 (this 5 can not be omitted)

++++ the specific use of this should be the ++++++
Man level target
Man 1 File name # # # #查找命令的帮助
Man 5 file name # # # #查找配置文件的帮助
Man Exit # # #按q

Quick usage of +++++++++man ++++++++


/Keyword # # #搜索关键字并且高亮显示结果
N # # #向下匹配高亮结果
N # # #向上匹配高亮结果
Pagup # # #向上滚动一个屏幕
Pagdown # # #向下滚动一个屏幕
Up Key # # #向上滚动一行
Next Key # # #向下滚动一行
D # # #向下滚动半个屏幕
U # # #向上滚动半个屏幕
G # # #回到man的最前面
G # # #回到man的最后面
Q # # #退出man页面

------------------------------------------------End--------------------------------------------------

Management----------------------for--------------------------------------------output


------------------------
Execute under normal user
Find/etc-name passwd
Output
Find: '/etc/pki/ca/private ': Permission denied
Find: '/etc/pki/rsyslog ': Permission denied
Find: '/etc/audit ': Permission denied
/ETC/PASSWD # # #正确输出
Find: '/ETC/POLKIT-1/RULES.D ': Permission denied
Find: '/etc/polkit-1/localauthority ': Permission denied
Find: '/etc/dhcp ': Permission denied
Find: '/etc/selinux/targeted/modules/active ': Permission denied
Find: '/etc/lvm/archive ': Permission denied
Find: '/etc/lvm/backup ': Permission denied
Find: '/etc/lvm/cache ': Permission denied
Find: '/ETC/GRUB.D ': Permission denied
/ETC/PAM.D/PASSWD # # #正确输出
Find: '/etc/audisp ': Permission denied
Find: '/etc/firewalld ': Permission denied
Find: '/etc/cups/ssl ': Permission denied
Find: '/etc/ipsec.d ': Permission denied
Find: '/etc/libvirt ': Permission denied
Find: '/ETC/SUDOERS.D ': Permission denied
Find: '/etc/named ': Permission denied # #其余都是错误输出
-

+++++++++++ How to manage output ++++++++++

Find/etc-name passwd > File # # # #重定向正确输出
Find/etc-name passwd 2> File # # # #重定向错误输出
Find/etc-name passwd &> File # # # #重定向所有输出
Find/etc-name passwd >> File # # #追加正确输出
Find/etc-name passwd 2>> File # # # #追加错误输出
Find/etc-name passwd &>> File # # # #追加输出
Find/etc-name passwd > File 2>&1 # # # #重新定义错误输出为正确

++++++++++++++ The following is the actual combat +++++++++++++++

[Email protected] desktop]$ find/etc/-name passwd 2> file2
# #存放错误的信息, # #在 Find a file named passwd in the/etc directory and put the wrong/correct information in the File2 file (redirected error Output)

[Email protected] desktop]$ find/etc/-name passwd > file
# #存放正确的信息 (redirect correct output)

[Email protected] desktop]$ find/etc/-name passwd &> file
# #无论正确还是错误信息都存放 (redirect all outputs)

[Email protected] desktop]$ >file
# #清空file里存储的信息

[[email protected] desktop]$ WC file
# #查看是否清空 ———— >0 0 0 file

Another way is to not want the information to be overwritten and put him behind the file:
[Email protected] desktop]$ find/etc/-name passwd >> file
# #在file文件里追加正确信息 (append correct output)
[Email protected] desktop]$ find/etc/-name passwd 2>> file
# #在file文件里追加错误的信息 (append error Output)
[Email protected] desktop]$ find/etc/-name passwd &>> file
# #在file文件里追加以上两种信息 (Append output)

Find/etc-name passwd > File 2>&1 # # # #重新定义错误输出为正确

-------------------------------------------------End------------------------------------------------


-----------------------------------------------Pipe character (|)------------------------------------------
Function: Let the output handle the input
1 tee ———————— > copy an output
2 > ———————— > Saved output
3 2>&1 | ———————— > Convert error Output to correct again by pipeline

++++++++++++ Classroom Exercises: +++++++++++
1 [[Email protected] desktop]$ find/etc/-name passwd 2>1 | Cat-b |tee File|wc-l
# #只要正确的信息 and dump it into file


2 Select 8-10 lines in the message save and display the number of rows
[Email protected] desktop]$ cat-b/etc/passwd File | head-10 |tail-3|tee File

3 Show all information and display the number of lines
[Email protected] desktop]$ cat-b/etc/passwd file
---------------------------------------------------End------------------------------------------


-----------------------------------------------VIM Basic Operation---------------------------------------
1. Command mode
Set
vim/etc/file name
+++++++++++++ keyword search +++++++++++++++
/keywords
N Match down
N Up match

Exit mode of 2.vim
Enter in command mode
: Q # # #退出, can be used when no changes have been made to the file
: q! # # #强制退出
: Wq # # #退出保存
: wq! # # #强制退出保存
--------------------------------------------------End--------------------------------------------

--------------------------------------------a text editor in a drawing gedit-----------------------------------

Crtl+n # #新建窗口
Ctrl+s # #保存文件
Ctrl+o # #打开文件
Ctrl+x # #剪切
Ctrl + V # #粘贴
CTRL + C # #复制
For Giedit software help view can be used
Yelp Help:gedit
----------------------------------------------------End-------------------------------------------------

Linux Learning Note Two

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.