linux 指令

绝对路径:/home/user1/temp.c
相对路径:1  现在的位置是home  ./user1/temp.c  从home目录下开始寻找
        2  现在的位置是home   user1     所有操作默认为当前路径  


一、用户管理类
1、useradd sun           #增加名为sun的用户
2、su sun            #切换到sun的用户
3、su                #切换到超级用户
4、passwd sun            #修改sun用那个户的密码

二、文件操作类
1、ls /home             #将列出/home目录下的所有文件和子目录
   ls                #将列出当前目录下的所有文件和子目录
   ls -a /home            #将列出/home目录下的所有文件和子目录(包括隐藏文件)
   ls -l /home            #将列出/home目录下的所有文件和子目录的详细信息
   ls -al /home
   ls -l /home   ==  ll /home
   ls /root/class1
   ls ./class1
2、pwd                 #显示当前目录的绝对路径 /home/bin
3、cd /root/class1        #进入/root/class1目录下
   cd ./class1          #或cd class1
   cd ..            #回到上一级目录
4、mkdir file               #创建名为file的文件夹
   touch example.c        #创建名为example.c的文件,但不打开
   vim example.c        #打开和创建名为example.c的文件
5、cp example1.c example2.c    #复制并重命名example1.c为example2.c
   cp example.c /root/Desktop/    #将example.c文件复制到/root/Desktop/目录下
   cp -r ../0714 ./0714        #-r将目录一复制到目录二下
6、mv example1.c example3.c    #对文件进行重命名
   mv example.c 123        #将文件移动到目录下
   mv 123 234            #目录重命名
   mv ./0714 ./234        #移动目录
7、rm example2.c
   rm -f example.c        #删除文件不给出提示信息
   rm -rf file            #删除目录不给出提示信息
8、cat -n example3.        #将文件编号进行输出
9、wc example3.c            #显示文件的行数、字数、字节数
10、chmod u+x example3.c     
    chmod 775 example3.c 

root/class   绝对路径
./class       相对路径   ==   class


ls class1                  #用相对路径列出该目录当中的内容
ls /root/class1            #用绝对路径列出该目录当中的内容
ls == ls .            #没有给出目录名或文件名,则显示当前目录下的所有文件和子目录
ls ..                #列出父目录的内容
ls /home            #列出指定路径的内容
ls -a /home            #列出指定路径的所有内容(包含隐藏文件)
ls -l                #列出当前目录文件的详细信息
ls -l == ll
ls -al                #列出当前路径的所有内容的详细信息(包含隐藏文件)

pwd                #用来显示当前的工作目录的绝对路径

cd ..                #回到上一级目录
cd /home            #以绝对路径的方式进入目录

cp 1.c class1/            #复制1.c到class1目录中

cp 1.c 3.c            #复制1.c为3.c到当前目录
cp -r file ./class1        #将file目录复制到class1

mv 1.c 2.c            #将1.c重命名为2.c
mv 1.c file            #将1.c移动到当前目录下的file目录中
mv file1 file2            #将目录file1移动到目录file2中

rm 1.c                #将1.c删除并给出提示信息
rm -f 1.c            #将1.c删除并不给出提示信息
rm -r file            #将目录file删除并给出提示信息

cat 1.c                #将1.c的内容打印到终端上

chmod u+x 1.c
chmod +x 1.c
chmod -x 1.c
chmod u=x 1.c

chmod 750 1.c


ln -s 1.c link

grep -n main 1.c

find /root/class1/ -name '1.c' -user 'root' -type 'f'

tar -cvf file1.tar file1
shutdown -r +3
man 2 ls

ps -aux
ps -ef

ifconfig eth0 192.168.1.123 netmask 255.255.255.0 broadcast 192.168.1.234

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值