File, disk management (Linux)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_41596915/article/details/98794707

File Manager
LS (List) lists the folders and files in a directory
-lh (lines) (human-readable ) by line displays the file size

clear clear screen

CD / Home / Test open absolute path
cd test opened relative path
cd ~ Back User Directory
CD ... Back up a directory

man (Manual) have problems to find a man!

pwd (Print Working Directories) to print a file or directory location

mkdir/rmdir (make directory / remove empty directory)

rm(remove files)
-i (prompt before removal) 交互式询问
-f (force)
-r (remove directories)

LN (Lines) hard-wired not disappear with the disappearance of the source file and
a shortcut -s (soft) soft connection is similar, with the source files vanishes

cat jointly or print files

gedit edit files

grep (match patterns) matching text
grep 'patterns' * .txt
-i (the ignore Case) ignoring case
-n number of lines of text display
patterns may be regular expression
^ a line beginning at a
ke ke line ending $
[Ss] igna [Ll] matches [] in a series of characters; search word match signal, signaL, Signal, SignaL line;
EE arbitrary matching between a character e and e

find find files
find ./ -name test.sh find the current directory of all files named test.sh
find ./ -name ' .sh' find the current directory for all file suffix .sh
find ./ -name "[ AZ]
"Find all files that begin with a capital letter in the current directory
find / tmp -size 2M 2M to find equal in the / tmp directory file
find / tmp -size + 2M 2M to find files larger than in the / tmp directory
find / tmp -size -2M find the file in / tmp directory is less than 2M
find ./ -size + 4k -size -5M find the current directory is greater than 4k, the file is smaller than 5M
find ./ -perm 0777 find the current directory permissions 777 file or directory

CP (Copy Files) / Music Videos (Move Files)
-f (Force)
-i switched interrogation
-R & lt (Directories)
-v display progress

Archive management tar
<1> compressed to the specified folder
will test1, test2, testdir packaged and compressed to / home / ziyang0421 / test / test111 /

[ziyang0421@localhost test]$ tar -czvf /home/test/test111/test1.tar.gz {test1,test2,testdir}
test1
test2
testdir/
testdir/testdir2/
testdir/testdir2/test1_soft
testdir/test111/

<2> within the package to see a list of files, do not unpack

[ziyang0421@localhost test111]$ tar -tf test1.tar.gz 
test1
test2
testdir/
testdir/testdir2/
testdir/testdir2/test1_soft
testdir/test111/

<3> to extract the packets in the designated file folder
to test1.tar.gz to extract / home / ziyang0421 / test / testdir / folder

[ziyang0421@localhost test111]$ tar -xzvf test1.tar.gz -C /home/ziyang0421/test/testdir/
test1
test2
testdir/
testdir/testdir2/
testdir/testdir2/test1_soft
testdir/test111/

Guess you like

Origin blog.csdn.net/qq_41596915/article/details/98794707