Linux 日常命令(前端开发)

本文详细介绍Linux环境下常用的文件操作命令,包括查看目录文件、创建文件及目录等,并演示如何使用ls命令的不同选项来获取目录信息,以及如何利用diff命令比较文件和文件夹之间的差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

All in all

Daily Commands

Find

ls

See what are the files in current directory.

ls

wangxiaoqiang@localhost:.ssh$ ls 
authorized_keys  id_rsa           id_rsa.pub       known_hosts

See what are the files in current directory, in details.

ls -l

wangxiaoqiang@localhost:.ssh$ ls -l
total 40
-rw-------  1 wangxiaoqiang  staff   407  5 12  2017 authorized_keys
-rw-------  1 wangxiaoqiang  staff  1679 10 25  2016 id_rsa
-rw-r--r--  1 wangxiaoqiang  staff   407 10 25  2016 id_rsa.pub
-rw-r--r--  1 wangxiaoqiang  staff  4132  1  9 11:23 known_hosts

See what are the files in current directory, in details and with time DESC ordered.

ls -lt

wangxiaoqiang@localhost:.ssh$ ls -lt 
total 40
-rw-r--r--  1 wangxiaoqiang  staff  4132  1  9 11:23 known_hosts
-rw-------  1 wangxiaoqiang  staff   407  5 12  2017 authorized_keys
-rw-------  1 wangxiaoqiang  staff  1679 10 25  2016 id_rsa
-rw-r--r--  1 wangxiaoqiang  staff   407 10 25  2016 id_rsa.pub

See what are the files in current directory, with time DESC ordered.

ls -t file1 file2

wangxiaoqiang@localhost:.ssh$ ls -t /tmp/ /var/
/tmp/:
stackman-1516008944.log       com.apple.launchd.j1hPxnRhOU/ com.apple.launchd.rYKqIWW4HH/

/var/:
log/      vm/       tmp/      install/  yp/       at/       rwho/     empty/    msgs/     folders/  agentx/   jabberd/
run/      db/       audit/    networkd/ spool/    ma/       backups/  mail/     netboot/  lib/      rpc/      root/

find

Create

touch

mkdir

See

grep

diff

See differences between two files, to see what are the differences from fileA to fileB?

diff -Nu fileA fileB

See differences between two folders, to see what are the differences from folderA to folderB?

diff -Nur folderA folderB

awk

Change

sed

cut

Other

date

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值