Linux 目录和文件的操作
整理常用的linux
命令,关于目录和文件的操作,用于巩固记忆,以备不时之需。
[root@localhost ~]#
root
:当前用户
localhost
:主机名
~
:当前所在位置
符号#
:管理员
符号$
:普通用户
命令字 [选项] [参数]
1.命令字:命令名称,使用命令字能唯一确定一条命令。
2.选项:调节命令的具体功能,决定这条命令如何执行。
短格式选项:
-
字母长格式选项:
--
单词
一般情况下,"-"字母,"--"单词,有例外。
3.参数:命令字处理对象,通常是文件名、目录、用户等内容。
4.辅助操作
Tab
:自动补齐
\
:强制换行
|
:管道符
Ctrl + u
:清空光标前所有内容
Ctrl + k
:清空光标后所有内容
Ctrl + l
:清屏,同clear
Ctrl + c
:中断,取消编辑
Ctrl + d
:登出,同exit
帮助手册
linux
命令数量繁多,具体选项也各不相同,不可能全部记住,学会使用帮助手册可以大大提升效率。
--help 选项:ls --help
man 手册页:man ls
操作类型 | 操作键 | 功能 |
---|---|---|
移动 | ↑、↓ | 上、下 |
翻页 | Page Down | 向下翻动一整页内容 |
^ | Page Up | 向上翻动一整页内容 |
退出 | q或Q | 退出手册阅读环境 |
查找 | /-v | 查找 "-v" 选项的帮助信息 |
^ | n | 看下一个匹配项 |
^ | N | 向上一个匹配项 |
Linux 系统目录结构
[root@localhost ~]# ls /
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
/bin
:bin
是Binary
的缩写, 这个目录存放着最经常使用的命令。
/boot
:这里存放的是启动Linux
时使用的一些核心文件,包括一些连接文件以及镜像文件。
/dev
:dev
是Device
的缩写, 该目录下存放的是Linux
的外部设备,在Linux
中访问设备的方式和访问文件的方式是相同的。
/etc
:这个目录用来存放所有的系统管理所需要的配置文件和子目录。
/home
:用户的主目录,在Linux
中,每个用户都有一个自己的目录,一般该目录名是以用户的账号命名的。
/lib
:这个目录里存放着系统最基本的动态连接共享库,其作用类似于Windows
里的DLL
文件。几乎所有的应用程序都需要用到这些共享库。
/media
:linux
系统会自动识别一些设备,例如U盘、光驱等等,当识别后,linux
会把识别的设备挂载到这个目录下。
/mnt
:系统提供该目录是为了让用户临时挂载别的文件系统的,我们可以将光驱挂载在/mnt/
上,然后进入该目录就可以查看光驱里的内容了。
/opt
:这是给主机额外安装软件所摆放的目录。比如你安装一个ORACLE
数据库则就可以放到这个目录下。默认是空的。
/proc
:这个目录是一个虚拟的目录,它是系统内存的映射,我们可以通过直接访问这个目录来获取系统信息。
这个目录的内容不在硬盘上而是在内存里,我们也可以直接修改里面的某些文件,比如可以通过下面的命令来屏蔽主机的ping
命令,使别人无法ping
你的机器:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
/root
:该目录为系统管理员,也称作超级权限者的用户主目录。
/run
:是一个临时文件系统,存储系统启动以来的信息。当系统重启时,这个目录下的文件应该被删掉或清除。如果你的系统上有/var/run
目录,应该让它指向run
。
/sbin
:s
就是Super User
的意思,这里存放的是系统管理员使用的系统管理程序。
/srv
:该目录存放一些服务启动之后需要提取的数据。
/sys
:这是linux 2.6
内核的一个很大的变化。该目录下安装了2.6
内核中新出现的一个文件系统sysfs
。
sysfs
文件系统集成了下面3
种文件系统的信息:针对进程信息的proc
文件系统、针对设备的devfs
文件系统以及针对伪终端的devpts
文件系统。该文件系统是内核设备树的一个直观反映。
当一个内核对象被创建的时候,对应的文件和目录也在内核对象子系统中被创建。
/tmp
:这个目录是用来存放一些临时文件的。
/usr
:这是一个非常重要的目录,用户的很多应用程序和文件都放在这个目录下,类似于windows
下的program files
目录。
/usr/bin
:系统用户使用的应用程序。/usr/sbin
:超级用户使用的比较高级的管理程序和系统守护程序。/usr/src
:内核源代码默认的放置目录。
/var
:这个目录中存放着在不断扩充着的东西,我们习惯将那些经常被修改的目录放在这个目录下。包括各种日志文件。
参考链接:Linux 系统目录结构 | 菜鸟教程
pwd
- 显示出完整的当前活动目录名称
[root@localhost ~]# pwd
/root
cd
- 切换目录
..
:上一级目录,当前目录的父目录
.
:当前目录
~
:用户家目录
[root@localhost etc]# pwd
/etc
[root@localhost etc]# cd ~
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd -
/etc
[root@localhost etc]# pwd
/etc
[root@localhost etc]# cd ..
[root@localhost /]# pwd
/
cd -
:返回到上次所在的目录
ls
- 显示目录内容
-l
:以长格式显示文件和目录的列表,包括权限、大小等详细信息。
-a
:显示所有子目录和文件信息,包括"."和".."。
-A
:和-a
类似,但不包括"."和".."。
-d
:显示目录本身属性。
-h
:以人性化方式显示出目录和文件的大小,显示KB
、MB
等单位。要和-l
一起使用。默认单位为B
字节。
-R
:递归显示目录及其子目录的所有内容。
[root@localhost ~]# ls
anaconda-ks.cfg
[root@localhost ~]# ls -l
total 4
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
[root@localhost ~]# ls -a
. .. anaconda-ks.cfg .bash_logout .bash_profile .bashrc .cshrc .tcshrc
[root@localhost ~]# ls -A
anaconda-ks.cfg .bash_logout .bash_profile .bashrc .cshrc .tcshrc
[root@localhost ~]# ls -ld
dr-xr-x---. 2 root root 114 Aug 16 17:16 .
[root@localhost ~]# ls -lh
total 4.0K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
[root@localhost ~]# ls -R /
/:
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
/boot:
config-3.10.0-693.el7.x86_64 initramfs-0-rescue-ba010ae4b2944c52b216ec6259f230c0.img symvers-3.10.0-693.el7.x86_64.gz
efi initramfs-3.10.0-693.el7.x86_64.img System.map-3.10.0-693.el7.x86_64
grub initramfs-3.10.0-693.el7.x86_64kdump.img vmlinuz-0-rescue-ba010ae4b2944c52b216ec6259f230c0
grub2 initrd-plymouth.img vmlinuz-3.10.0-693.el7.x86_64
/boot/efi:
EFI
/boot/efi/EFI:
centos
//太长省略不写,一般没有人"ls -R /"这么写,这里纯粹写着玩的,看一下效果。
- 颜色对应的文件类型
黑色:数据文件
蓝色:目录(文件夹)
天蓝色:软链接文件(快捷方式)
绿色:可执行文件
红色:压缩包
若是用不同的远程终端连接可能颜色会有所差别,这里以图形化安装后的终端显示颜色为准。
- 匹配符号
?
:匹配一个字符
*
:匹配多个字符
[root@localhost test]# ls
temp1.txt temp2.txt test1.txt test2.txt
[root@localhost test]# ls test?.txt
test1.txt test2.txt
[root@localhost test]# ls t*
temp1.txt temp2.txt test1.txt test2.txt
alias
- 给命令起一个别名,常用于简化操作。
[root@localhost ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@localhost ~]# alias lh='ls -lh --color=auto'
[root@localhost ~]# lh
total 4.0K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
du
- 统计目录及文件空间占用情况
-a
:统计所有的文件
-h
:友好显示,默认单位KB
-s
:统计总大小
[root@localhost ~]# du -ah /root/
4.0K /root/.bash_logout
4.0K /root/.bash_profile
4.0K /root/.bashrc
4.0K /root/.cshrc
4.0K /root/.tcshrc
4.0K /root/anaconda-ks.cfg
24K /root/
[root@localhost ~]# du -sh /root/
24K /root/
mkdir
- 创建新的目录
-p
:嵌套创建多层目录
[root@localhost ~]# mkdir test1
[root@localhost ~]# ls
anaconda-ks.cfg test1
[root@localhost ~]# mkdir test2 test3
[root@localhost ~]# ls
anaconda-ks.cfg test1 test2 test3
[root@localhost ~]# mkdir -p test4/test5
[root@localhost ~]# ls
anaconda-ks.cfg test1 test2 test3 test4
[root@localhost ~]# ls test4/
test5
touch
- 创建空文件或修改时间标记
[root@localhost ~]# touch test.txt
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Aug 16 18:33 test.txt
[root@localhost ~]# touch test1.txt test2.txt
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Aug 16 18:33 test1.txt
-rw-r--r--. 1 root root 0 Aug 16 18:33 test2.txt
-rw-r--r--. 1 root root 0 Aug 16 18:33 test.txt
[root@localhost ~]# touch test.txt
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Aug 16 18:33 test1.txt
-rw-r--r--. 1 root root 0 Aug 16 18:33 test2.txt
-rw-r--r--. 1 root root 0 Aug 16 18:34 test.txt
cp
- 复制文件或目录
-f
:覆盖目标同名文件或目录时不提醒,强制复制。
-i
:覆盖目标同名文件或目录时提醒确认。
-p
:复制时保留源文件权限、属主及时间标记等属性不变。
-r
:复制目录时必须使用,递归复制所有文件及子目录。
[root@localhost ~]# mkdir test1 test2
[root@localhost ~]# touch temp.txt
[root@localhost ~]# ll
total 4
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 0 Aug 17 10:24 temp.txt
drwxr-xr-x. 2 root root 6 Aug 17 10:24 test1
drwxr-xr-x. 2 root root 6 Aug 17 10:24 test2
[root@localhost ~]# cp temp.txt test1/
[root@localhost ~]# ll test1/temp.txt
-rw-r--r--. 1 root root 0 Aug 17 10:26 test1/temp.txt
[root@localhost ~]# cp -f temp.txt test1/
cp: overwrite ‘test1/temp.txt’? y
[root@localhost ~]# ll test1/temp.txt
-rw-r--r--. 1 root root 0 Aug 17 10:30 test1/temp.txt
[root@localhost ~]# cp -p temp.txt test1/
cp: overwrite ‘test1/temp.txt’? y
[root@localhost ~]# ll test1/temp.txt
-rw-r--r--. 1 root root 0 Aug 17 10:24 test1/temp.txt
[root@localhost ~]# cp -r test2/ test1/
[root@localhost ~]# ll test1/
total 0
-rw-r--r--. 1 root root 0 Aug 17 10:24 temp.txt
drwxr-xr-x. 2 root root 6 Aug 17 10:33 test2
参数
-i
默认是加上的,可在别名中查看,所以即使加上-f
也不能强制覆盖。
- 加反斜杠
\cp
执行cp
命令时不走alias
[root@localhost ~]# \cp -f temp.txt test1/
[root@localhost ~]# ll test1/temp.txt
-rw-r--r--. 1 root root 0 Aug 17 10:39 test1/temp.txt
rm
- 删除文件或目录
-f
:删除时不提醒,强制删除。
-i
:删除时提醒确认。
-r
:删除目录时必须使用,递归删除整个目录树。
[root@localhost ~]# rm temp.txt
rm: remove regular empty file ‘temp.txt’? y
[root@localhost ~]# rm -rf test*
[root@localhost ~]# ls
anaconda-ks.cfg
参数
-i
默认是加上的,可在别名中查看。还有就是谨慎使用rm -rf
。
mv
- 移动文件或目录、改名
[root@localhost ~]# mkdir test
[root@localhost ~]# touch test1.txt
[root@localhost ~]# ls
anaconda-ks.cfg test test1.txt
[root@localhost ~]# mv test1.txt test
[root@localhost ~]# cd test/
[root@localhost test]# ls
test1.txt
[root@localhost test]# mv test1.txt test2.txt
[root@localhost test]# ls
test2.txt
which
- 查找用户所执行的命令文件存放的目录,搜索范围由
PATH
决定。
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
find
- 查找文件或目录
find [查找范围] [查找条件表达式]
-name
:按名称查,可使用*
、?
通配符。
-size
:按大小查,大于用+
,小于用-
,单位有kB
(k
小写)、MB
、GB
。
-user
:按属主查。
-type
:按类型查,f
普通文件、d
目录、b
块设备文件、c
字符设备文件。块设备指成块读取数据的设备(硬盘、内存等),字符设备指按单个字符读取数据的设备(键盘、鼠标等)。
- 同时使用多个查找条件时,使用逻辑运算符,
-a
表示and
,要同时满足,-o
表示or
,满足一个即可。
[root@localhost ~]# find /boot/ -name "vmlinuz*" -a -size +1024k
/boot/vmlinuz-3.10.0-693.el7.x86_64
/boot/vmlinuz-0-rescue-ba010ae4b2944c52b216ec6259f230c0
[root@localhost ~]# find /boot/ -name "vmlinuz*" -o -size +10M
/boot/vmlinuz-3.10.0-693.el7.x86_64
/boot/initramfs-0-rescue-ba010ae4b2944c52b216ec6259f230c0.img
/boot/vmlinuz-0-rescue-ba010ae4b2944c52b216ec6259f230c0
/boot/initramfs-3.10.0-693.el7.x86_64.img
/boot/initramfs-3.10.0-693.el7.x86_64kdump.img
cat
- 显示并连接文件的内容
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="01f37041-45dc-4840-a3b1-5fcca0d76448"
DEVICE="ens33"
ONBOOT="yes"
[root@localhost ~]# cat /etc/redhat-release /proc/version
CentOS Linux release 7.4.1708 (Core)
Linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017
more
- 分页查看文件的内容,左下角显示百分比(看到最后会自动退出)
Enter
:下一行
空格
:下一页
b
:上一页
q
:退出
[root@localhost ~]# yum install httpd -y
[root@localhost ~]# more /etc/httpd/conf/httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
//省略
less
- 类似
more
,但功能更多,左下角显示文件名(看到最后不会退出)
Enter
:下一行
空格、Page Down
:下一页
b、Page Up
:上一页
q
:退出
/
:查找/
后面跟的内容
n
:查找下一个
N
:查找上一个
[root@localhost ~]# less /etc/httpd/conf/httpd.conf
head
- 查看开头部分内容,默认
10
行。
-n
:显示n
行
[root@localhost ~]# head -2 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
tail
- 查看末尾部分内容,默认
10
行。
-n
:显示n
行
-f
:跟踪尾部内容的动态更新,一般用来监控日志。
[root@localhost ~]# tail -2 /etc/passwd
chrony:x:998:996::/var/lib/chrony:/sbin/nologin
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
wc
- 默认统计文件内容中行数、单词个数、字节大小信息
-l
:统计行数
-w
:统计单词数
-c
:统计字节数
[root@localhost ~]# wc /etc/hosts
2 10 158 /etc/hosts
[root@localhost ~]# wc -l /etc/hosts
2 /etc/hosts
[root@localhost ~]# wc -w /etc/hosts
10 /etc/hosts
[root@localhost ~]# wc -c /etc/hosts
158 /etc/hosts
[root@localhost ~]# find /etc/ -name "*.conf" | wc -l
102
grep
- 检索、过滤文件内容
-i
:忽略大小写
-v
:反转查找
^..
:表示以..为开头
..$
:表示以..为结尾
^$
:表示空行
[root@localhost ~]# grep "bin/bash" /etc/passwd
root:x:0:0:root:/root:/bin/bash
[root@localhost ~]# grep -v "#" 文件 | grep -v "^$"
[root@localhost ~]# cat 文件 | grep -v "#" | grep -v "^$"
gzip & gunzip
- gzip:压缩、解压缩格式为
.gz
压缩包 - 不保留源文件
-9
:提高压缩的比率
-d
:解压
[root@localhost ~]# ls -lh
total 16K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 12K Aug 17 13:37 test.txt
[root@localhost ~]# gzip test.txt
[root@localhost ~]# ls -lh
total 12K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 4.5K Aug 17 13:37 test.txt.gz
[root@localhost ~]# gzip -d test.txt.gz
[root@localhost ~]# ls -lh
total 16K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 12K Aug 17 13:37 test.txt
- gunzip:解压缩格式为
.gz
压缩包,和gzip -d
一样。
bzip2 & bunzip2
- bzip2:压缩、解压缩格式为
.bz2
压缩包,类似gzip
,但压缩效率比gzip
好。 - 不保留源文件
[root@localhost ~]# bzip2 test.txt
[root@localhost ~]# ls -lh
total 12K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 4.3K Aug 17 13:37 test.txt.bz2
[root@localhost ~]# bzip2 -d test.txt.bz2
[root@localhost ~]# ls -lh
total 16K
-rw-------. 1 root root 1.3K Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 12K Aug 17 13:37 test.txt
- bunzip2:解压缩格式为
.bz2
压缩包,和bzip2 -d
一样。
tar
- 归档和释放工具
- 保留源文件
-z
:调用gzip程序进行压缩或解压。
-j
:调用bzip2程序进行压缩或解压。
-c
:创建.tar格式的包文件。
-x
:解开.tar格式的包文件。
-v
:输出详细信息。
-f
:表示使用归档文件。
-C
:解压时指定释放的目标文件夹。
-t
:列表查看包内的文件。
-p
:打包时保留文件及目录权限。
-P
:打包时保留文件及目录的绝对路径。
[root@localhost ~]# mkdir test
[root@localhost ~]# cd test/
[root@localhost test]# touch test1.txt test2.txt test3.txt
[root@localhost test]# ls
test1.txt test2.txt test3.txt
[root@localhost ~]# tar -zcvf test.tar.gz test/
test/
test/test1.txt
test/test2.txt
test/test3.txt
[root@localhost ~]# ls
anaconda-ks.cfg test test.tar.gz
[root@localhost ~]# tar -zxvf test.tar.gz -C /opt/
test/
test/test1.txt
test/test2.txt
test/test3.txt
[root@localhost ~]# ls -R /opt/
/opt/:
test
/opt/test:
test1.txt test2.txt test3.txt
[root@localhost ~]# tar -jcvf test.tar.bz2 test/
test/
test/test1.txt
test/test2.txt
test/test3.txt
[root@localhost ~]# ls
anaconda-ks.cfg test test.tar.bz2
[root@localhost ~]# tar -jxvf test.tar.bz2 -C /opt/
test/
test/test1.txt
test/test2.txt
test/test3.txt
[root@localhost ~]# ls -R /opt/
/opt/:
test
/opt/test:
test1.txt test2.txt test3.txt
echo
>
:重定向(会覆盖)
>>
:追加(不会覆盖)
[root@localhost ~]# echo "this is test file1" > test.txt
[root@localhost ~]# cat test.txt
this is test file1
[root@localhost ~]# echo "this is test file2" > test.txt
[root@localhost ~]# cat test.txt
this is test file2
[root@localhost ~]# echo "this is test file3" >> test.txt
[root@localhost ~]# cat test.txt
this is test file2
this is test file3
ln
- 在文件之间建立连接
-s
:创建软链接(快捷方式)
ls -i
:查看文件节点序列号
[root@localhost ~]# ls -i test.txt
33574994 test.txt
[root@localhost ~]# ll
total 16
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 11753 Aug 17 13:37 test.txt
- 创建软链接(快捷方式,源文件删除影响访问)
[root@localhost ~]# ln -s test.txt stest.txt
[root@localhost ~]# ll
total 16
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
lrwxrwxrwx. 1 root root 8 Aug 17 13:52 stest.txt -> test.txt
-rw-r--r--. 1 root root 11753 Aug 17 13:37 test.txt
- 创建硬链接(创建别名,源文件删除不影响访问)
[root@localhost ~]# ln test.txt htest.txt
[root@localhost ~]# ll
total 28
-rw-------. 1 root root 1241 Aug 16 17:16 anaconda-ks.cfg
-rw-r--r--. 2 root root 11753 Aug 17 13:37 htest.txt
lrwxrwxrwx. 1 root root 8 Aug 17 13:52 stest.txt -> test.txt
-rw-r--r--. 2 root root 11753 Aug 17 13:37 test.txt
history
-c
:清除历史记录
[root@localhost ~]# history
1 ls
2 ls -l
3 history
[root@localhost ~]# history -c
[root@localhost ~]# history
1 history
vi & vim
- 很重要,内容较多,单独写了一篇,点此查看详情。
最后
还是那句话,linux
命令数量繁多,具体选项也各不相同,不可能全部记住,学会使用帮助手册可以大大提升效率。
Linux 目录和文件的操作的更多相关文章
- Python:目录和文件的操作模块os.path和OS常用方法
1.目录和文件的操作模块os.path,在使用之前要先导入:import os.path.它主要有以下几个重要的功能函数: #!/user/bin/python #coding= utf-8 impo ...
- Linux目录和文件——查询目录和文件的命令
Linux目录和文件——查询目录和文件的命令 摘要:本文主要学习了在Linux系统中是如何查询目录和文件的. which命令 which命令是根据PATH环境变量设置的路径,去搜索执行文件. 基本语法 ...
- Linux目录和文件——管理目录和文件的命令
Linux目录和文件——管理目录和文件的命令 摘要:本文主要学习了Linux系统中关于目录和文件的操作. cd命令 cd命令用来切换工作目录,是Change Directory的缩写. 基本语法 cd ...
- Linux目录和文件——目录格式
Linux目录和文件——目录格式 摘要:本文主要了解了Linux系统的目录格式. 一切皆文件 Linux下“一切皆文件”是Unix/Linux的基本哲学之一. Linux中所有内容都是以文件的形式保存 ...
- Linux 目录结构及详细操作
目录 Linux 目录结构及详细操作 目录结构 目录结构的特点 目录结构挂载 目录结构发展 关闭selinux(了解) 重要目录说明(etc目录说明) 1.网卡配置文件 2.解析配置文件 3.主机名称 ...
- linux 目录下文件批量植入和删除,按日期打包
linux目录下文件批量植入 [root@greymouster http2]# find /usr/local/http2/htdocs/ -type f|xargs sed -i " ...
- 03- Linux目录与文件进阶操作
第三课 目录与文件进阶操作cat (一次性全部输出文件内容) cat -n 文件名 显示行号 cat -b 文件名 空行不显示行号less (分页显示,可以上下翻页,光标键上下键,PageUp ...
- Linux 目录和文件操作
Linux常用命令--目录和文件操作 [目录]删除.复制.移动 : 1.删除文件夹用:rmdir 文件夹名 但是rmdir不能删除非空的文件夹,那如何删除非空文件夹呢: 2.通常情况下,删除文件用:r ...
- Linux 目录与文件的基本操作
1 目录与文件 1.1 文件 硬盘中的数据在操作系统中的体现为文件. 1.2 目录 目录的概念不是文件集合.目录和文件一样,目录也是文件.目录是找到文件的“踏板”.目录的本质是路径映射. 1.3 Li ...
随机推荐
- Java12新特性 -- 其他新增,移除,废弃项
支持unicode 11 JDK 12版本包括对Unicode 11.0.0的支持.在发布支持Unicode 10.0.0的JDK 11之后,Unicode 11.0.0引 入了以下JDK 12中包含 ...
- (原)关于使用imagemagick将gif叠加到图片或者画布上的方法,以及疑难杂症
今天因为项目过程中,有一个小需求,需要将一个指定的gif按照指定大小,叠加到画布的指定位置上,本来对于熟悉这块的人,简直就是小菜一碟哈,但本人因为对imagemagick的不熟悉,导致在这个需求上摸索 ...
- ASP.NET Core 之跨平台的实时性能监控
前言 前面我们聊了一下一个应用程序 应该监控的8个关键位置. . 嗯..地址如下: 应用程序的8个关键性能指标以及测量方法 最后卖了个小关子,是关于如何监控ASP.NET Core的. 今天我们就来讲 ...
- [IISNode] 如何在IIS7/8下,配置一个可以通过IIS访问NodeJS的web项目
参考了一下几篇很给力的文章,在每篇文章中,都学到了解决遇到的问题的答案: (1)用iisnode模块,让你的Node.js应用跑在Windows系统IIS中 (2)让IIS能够运行Nodejs (3) ...
- bridge和原生交互的简单用法
首先获取当前环境是ios还是Android var u = navigator.userAgent; var isAndroid = u.indexOf('Android') > -1 || u ...
- 【记录】【solr】whose UTF8 encoding is longer than the max length 32766
java添加数据到solr报错 whose UTF8 encoding is longer than the max length 32766 原因是长度太长,string类型改成text_gener ...
- SQL Server 数据库启动过程(用户数据库加载过程的疑难杂症)
前言 本篇主要是上一篇文章的补充篇,上一篇我们介绍了SQL Server服务启动过程所遇到的一些问题和解决方法,可点击查看,我们此篇主要介绍的是SQL Server启动过程中关于用户数据库加载的流程, ...
- Linux Docker Introduction
Setup on Ubuntu. 前提条件: Docker需要两个重要的安装要求: 它仅适用于64位Linux安装,注意:是64位的Linux系统. 它需要Linux内核版本3.10或更高版本. 要查 ...
- Python基础(七)——文件和异常
1.1 读取整个文件 我们可以创建一个 test.txt 并写入一些内容,使用 Python 读文件操作,读出文本内容. with open(r'E:\test.txt') as file_objec ...
- -Gradle 翻译 Merge AndroidManifest 合并清单文件 MD
目录 目录 Merge AndroidManifest 合并清单文件 合并多个清单文件 合并优先级 合并冲突启发式算法 合并规则的标记 节点标记 属性标记 Attribute markers 标记选择 ...