Linux_shell Command Description

1.1 pwd command
English explanation of the command to print working directory (print working directory). Enter the pwd command, Linux will output the current directory.
1.2 cd command
the cd command to change directories.
cd / go to the root directory
Go cd ~ / home / user user directory
usr directory under cd / usr go to the root directory of absolute path -------------
cd test to test subdirectory under the current directory, the relative path -------
1.3 ls command
ls command to view the contents of the directory.
 
1.5 grep command
The maximum function grep command is to find a specific string in a pile of documents.
grep money test.txt
The above command to find money in the string in test.txt, grep lookup is case-sensitive.
1.6 touch command
touch command to create a new file, he can create a blank file, you can add text and data therein.
touch newfile This command creates a blank file called newfile in.
1.7 cp command
cp command to copy files to copy the file, enter the command:
cp <source filename> <target filename>
cp t.txt Document / t This command will t.txt file copied to the Document directory and named t
1.8 mv command
mv command to move files.
Options
Explanation
-i
Interactive: If you select a file overwrites the file in the target, he will be prompted to confirm
-f
Forced: it will surpass the interactive mode, move files without prompting, are very dangerous option
-v
Details: Shows the progress of moving files
mv t.txt Document t.txt the file to the directory in the Document.
1.9 rm command
rm command to delete a file.
Options
Explanation
-i
Interactive: prompt to confirm the deletion
-f
Forced: instead of interactive mode, not prompted to confirm the deletion
-v
Details: delete the file progress display
-r
Recursive: deletes a directory and all files and subdirectories in which
rm t.txt This command deletes the file t.txt
1.10 rmdir命令
rmdir命令用来删除目录。
 
角色转换:
su 用户名 (如果没有输入用户名则预设为root)
举例说明,假设当前用户user01,想要转变为user02,则输入命令:
su user02
系统返回:
password:
此时,输入user02的指令,就会变为user02。
 
权限修改
文件的使用者
说明
权限
说明
增减
说明
u
拥有文件的用户
r
读取权
+
添加权限
g
所有者所在的组群
w
写入权
-
删除权限
o
其他人
x
执行权
=
是它称为唯一权限
a
全部(u,g和o)
       
删除某一文件的所有权限,输入命令:
chmod a-rwx test.txt
为文件所有者添加权限,输入命令:
chmod u+rwx test
还可以用数字表示权限:4——读取,2——写入,1——执行。下面的两个命令等价:
chmod 751 filename
chmod u+rwx,g=rx,0=x filename
 
 
mkdir [-p] dirName
mkdir命令用于建立名称为 dirName 之子目录。
-p 确保目录名称存在,不存在的就建一个。
mkdir -p BBB/Test
在工作目录下的 BBB 目录中,建立一个名为 Test 的子目录。 若 BBB 目录原本不存在,则建立一个。(注:本例若不加 -p,且原本 BBB目录不存在,则产生错误。)

Guess you like

Origin www.cnblogs.com/TomBombadil/p/11006328.html