The road to operation and maintenance - commands (files and directories)

cd /home Enter the '/home' directory '
cd .. Return to the previous directory
cd ../.. Return to the previous directory
cd Enter the personal home directory
cd ~user1 Enter the personal home directory
cd - Return to the last location directory
pwd show working path
ls view files in a directory
ls -F view files in a directory
ls -l show details of files and directories
ls -a show hidden files
ls *[0-9]* show filenames and directories containing numbers Name
tree shows the tree structure of files and directories starting from the root directory (1)
lstree shows the tree structure of files and directories starting from the root directory (2)
mkdir dir1 creates a directory called '
dir1 ' '
mkdir dir1 dir2 creates two at the same time directories
mkdir -p /tmp/dir1/dir2 create a directory tree
rm -f file1 delete a file called ' file1' rmdir dir1 delete a directory called ' dir1 ' rm -rf dir1 delete a file called 'dir1'

directory and delete its contents
rm -rf dir1 dir2 delete both directories and their contents at the same time
mv dir1 new_dir rename/move a directory
cp file1 file2 copy a file

cp dir1 dir2 If the dir2 directory does not exist, you can use cp -r dir1 dir2 directly, if the dir2 directory already exists, you need to use cp -r dir1/.dir2

cp -a /tmp/dir1 . Copy a directory to the current working directory
cp -a dir1 dir2 Copy a directory
ln -s file1 lnk1 Create a soft link to a file or directory
ln file1 lnk1 Create a physical link to a file or directory
touch -t 0712250000 file1 Modify timestamp of a file or directory - (YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -l list known encodings
iconv -f fromEncoding -t toEncoding inputFile > outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg - print - exec convert "{}" -resize 80 x6 0 "thumbs/{}" \; batch resize files in the current directory andsend them to a thumbnails directory (requires convert from Imagemagick)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324844883&siteId=291194637
Recommended