New file
Touch creates a timestamp for a file or an update file. If the file does not exist, a new file is created and the timestamp of the file is updated if the file exists.
For example: Create 1.txt under the Uzz directory, create 2.txt in the Uzz xk directory
[[email protected] uzz]# Touch 1.txt [[email protected] uzz]# Touch xk/2.txt [[email protected] uzz]# ls 1.txt xk [email protected] uzz]# ls xk 2.txt wlgc [[email protected] uzz]#
2. View Files
Cat directory Name/file name
[Email protected] xk]# cat/etc/sysconfig/network-scripts/ifcfg-eth0 device=eth0 hwaddr=00:0c:29:06:1c:66 TYPE=Ethe Rnet uuid=3bfb0110-c5ed-446c-856e-530bb2097725 onboot=yes nm_controlled=yes bootproto=none USERCTL=no IPV6INIT =no ipaddr=192.168.80.222 netmask=255.255.255.0 gateway=192.168.80.1 dns1=8.8.8.8 [[email protected] xk]#
3. Move/Copy files/folders
CP Copy File/folder
Format: CP parameter source target
For example: Copy the 2.txt under the Uzz/xk to the Uzz:
[email protected] xk]# CP 2.txt/uzz [[email protected] xk]# ls/uzz 1.txt 2.txt xk [[email protected] xk]#
MV Move files/folders
Format: MV parameter source target
Example: Move 1.txt under Uzz to the Uzz/xk folder
[Email protected] uzz]# mv 1.txt XK [[email protected] uzz]# ls xk 1.txt 2.txt wlgc [[email protected] uzz]#
4. editing files using VI
VI File name
Then press A or I into edit mode, edit the text, press ESC when finished editing, and press shift+: Enter WQ to save and exit
For example: Edit Uzz under 2.txt, Input: 1 2 3 4
[[email protected] uzz]# ls 2.txt xk [[email protected] uzz]# VI 2.txt 1 2 3 4 ~ ~ ~ "2.tx T "1L, 8C written [[email protected] uzz]# cat 2.txt 1 2 3 4 [[email protected] uzz]#
This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://xuxiaoliang.blog.51cto.com/10882951/1921174
Linux common file Management commands (2)