linux基本命令介绍(一)

Linux简介

Linux最初是由来自芬兰赫尔辛基大学的学生Linus Torvalds发明的。由于Linux是基于GPL(General Public License)的架构之下,因此它是免费的,任何人都可以免费使用或者修改其中的源代码。这就是所谓的“开放性架构”,这个开放性的架构满足了人们的不同需求,大家可以根据自己的需要来修改源代码,因此越来越流行。Linux内核的第一个版本(V1.0)在1994年发布。

Linux基本命令介绍

1.man

说明:man是Linux下的帮助指令,通过man指令可以查看Linux中的指令帮助、配置文件帮助和编程帮助等信息。
语法:man(选项)(参数)
选项:
-a:在所有的man帮助手册中搜索;
-f:等价于whatis指令,显示给定关键字的简短描述信息;
-P:指定内容时使用分页程序;
-M:指定man手册搜索的路径。
参数:
数字用来指定从哪本man手册中搜索帮助。
关键字表示指定要搜索帮助的关键字。


下例中示出“ls”命令的相关信息,示例仅显示其中的一部分。

[root@linux001 /] # man ls
LS(1) User Commands
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
--author
with -l, print the author of each file
-b, --escape
print C-style escapes for nongraphic characters
--block-size=SIZE
scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see SIZE format below
-B, --ignore-backups
do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise:
sort by ctime, newest first
-C list entries by columns
--color[=WHEN]
colorize the output; WHEN can be 'never', 'auto', or 'always' (the default); more info below
-d, --directory
list directories themselves, not their contents
-D, --dired
generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify
append indicator (one of */=>@|) to entries
<snip>

 

2.help

说明: help命令用于显示shell内部命令的帮助信息。help命令只能显示shell内部的命令帮助信息。而对于外部命令的帮助信息只能使用man或者info命令查看。
语法:help(选项)(参数)
选项:
-s:输出短格式的帮助信息。仅包括命令格式。
参数:
内部命令:指定需要显示帮助信息的shell内部命令。


应用示例:

[root@linux001 /] # ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them; e.g.,
'--block-size=M' prints sizes in units of
1,048,576 bytes; see SIZE format below
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information);
with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first
-C list entries by columns
--color[=WHEN] colorize the output; WHEN can be 'never', 'auto',
or 'always' (the default); more info below
-d, --directory list directories themselves, not their contents
-D, --dired generate output designed for Emacs' dired mode
<snip>

 

3.cd

说明:cd命令用来切换工作目录至dirname。 其中dirName表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的home directory(也就是刚login时所在的目录)。另外,~也表示为home directory的意思,.则是表示目前所在的目录,..则表示目前目录位置的上一层目录。
语法:cd (选项) (参数)
选项:
-p:如果要切换到的目标目录是一个符号连接,直接切换到符号连接指向的目标目录 -L 如果要切换的目标目录是一个符号的连接,直接切换到字符连接名代表的目录,而非符号连接所指向的目标目录。
-:当仅实用“-”一个选项时,当前工作目录将被切换到环境变量“OLDPWD”所表示的目录。


应用示例:

[root@linux001 /] #cd ~ 从任何目录跳转到用户的主目录
[root@linux001 /] #cd 从任何目录跳转到用户的主目录
[root@linux001 /] #cd /root 跳转到用户的根目录下的root文件夹
[root@linux001 /] #cd .. 返回上一级目录
[root@linux001 /] #cd ../../ 返回上两级目录
[root@linux001 /] #cd ~ 从任何目录跳转到用户的主目录
[root@linux001 /] #cd / 从任何目录跳转文件系统的根目录

未完待续····

posted on 2021-06-24 16:35  北亚数据恢复  阅读(49)  评论(0编辑  收藏  举报

导航