【linux】 基础命令

一、命令格式

**命令    选项     参数**

command option arguments

 命令: 实现某个功能的程序
 选项:  可供选择的项目,可接可不接,但是接了有特殊作用
长格式: 长选项  long option
短格式: 短选项 short option

命令、选项和参数之间必须要有空格

例如:

[root@lr-xiaoxin lianxi]# ls
123  a.txt  cds  hubei  hunan  ll  ls  python  xiongxihao  xx
[root@lr-xiaoxin lianxi]# ls -a hunan
.  ..  changsha  .ciao
[root@lr-xiaoxin lianxi]# 

代码中,ls -a hunan 就是标准格式

二、基本命令

1.ls命令—list 显示列表内容

ls:查看文件内容

(ls 里没有接参数,默认就是以当前文件夹作为参数)

-l 查看文件和文件夹的详细信息   
         use a long listing format
         
-a, --all 显示隐藏文件夹
          do not ignore entries starting with .
          不要忽略以.开头的条目(文件或者文件夹)
         (在linux里隐藏文件以.开头的)
[root@lr-xiaoxin hunan]# ls
changsha
[root@lr-xiaoxin hunan]# mkdir .xiangtan  huaihua
[root@lr-xiaoxin hunan]# ls
changsha  huaihua
[root@lr-xiaoxin hunan]# ls -a
.  ..  changsha  .ciao  huaihua  .xiangtan
[root@lr-xiaoxin hunan]# ls -l
总用量 0
drwxr-xr-x. 3 root root 19 120 21:48 changsha
drwxr-xr-x. 2 root root  6 122 20:34 huaihua

(其他用法使用man手册查看)

2、wc统计命令
wc 是一个统计命令
     统计行,单词,字节
     wc - print newline, word, and byte counts for each file
  -w, --words
          print the word counts
  -l, --lines
          print the newline counts
[root@lr-xiaoxin lianxi]# cat a.txt
sername = input(" please input your name ")  
password = getpass.getpass("please")          
print("your  name is:", username)             
print("your password is:", password)
[root@lr-xiaoxin lianxi]# wc a.txt
  4  19 177 a.txt
[root@lr-xiaoxin lianxi]# wc -w a.txt
19 a.txt
[root@lr-xiaoxin lianxi]# wc -l a.txt
4 a.txt
3、| 管道符号
作用: 将前面命令的输出送给后面的命令作为输入   (借花献佛)
     管道:是实现进程和进程之间通信的
[root@lr-xiaoxin lianxi]# ls -a|wc -w
14

4、which 、pwd–查看路径

which:查看文件夹存放路径
pwd:查看当前文件夹存放路径

[root@lr-xiaoxin lianxi]# which cd
/usr/bin/cd
[root@lr-xiaoxin lianxi]# pwd 
/root/lianxi
[root@lr-xiaoxin lianxi]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值