In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "basic file operation commands in Linux". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
cd
cd is the command to open a path, that is, open a folder and jump to it.
The code is as follows:
$ cd path ## path is the path you want to open.
Path has absolute path and relative path. Absolute path emphasizes from/to the path. The relative path is relative to the current path, assuming that the current home directory has an etc folder (absolute path should be/home/username/etc), if cd etc directly enters this folder, but if cd /etc/enters the system etc, you can understand it after thinking about it. Also in Linux, Represents the current directory,.. Represent parent directory, so return parent directory can cd..。
ls
ls is a list of files.
The code is as follows:
$ ls ###List only visible files in current directory
$ ls -l ###Lists details of visible files in the current directory
$ ls -hl ###Lists details and displays file size in readable size
$ ls -al ###Lists details of all files (including hidden ones)
Note: Linux is. The first file or folder is a hidden file or folder.
pwd
pwd is used to return the name of the current working directory, which is an absolute pathname.
The code is as follows:
$ pwd
/home
mkdir
mkdir is used to create a new folder.
The code is as follows:
$ mkdir folder
$ mkdir -p folder/subfolder ### -p parameter is ignored when the parent directory exists, if it does not exist, it will be established. Use this parameter to establish a multi-level folder.
rm
Rm means remove, delete the file.
The code is as follows:
$ rm filename ###Delete filename
$ rm -i filename ###Prompt before deleting filename, prompt each time if multiple files
$ rm -rf folder/subfolder/ ###Recursively delete all files and folders under subfolder, including subfolder itself
$ rm -d folder ###Delete empty folder
cp
cp means copy, copy files.
The code is as follows:
$ cp source dest ###Copy source to dest
$ cp folder/* dest ###Copy all files under folder (excluding files in subfolders) to dest
$ cp -r folder dest ###Copy all files under folder (including all files in subfolder) to dest
mv
MV is move, move files.
The code is as follows:
$ mv source folder ###Move source to folder, then folder/source
$ mv -i source folder ###When moving, if the file already exists, prompt ** Overwrite **
$ mv source dest ###If dest is not a directory, rename source to dest
cat
cat is used to output file contents to Terminal.
The code is as follows:
$ cat /etc/locale.gen ###Output the contents of locale.gen
$ cat -n /etc/locale.gen ###Output the contents of locale.gen and display the line number
more
More is similar to cat in that both can view file content, except that when a document is too long, cat can only display the last content that fills the screen, and the previous content is invisible. At this point, you can use more to display the content line by line.
The code is as follows:
$ more /etc/locale.gen
$ more +100 /etc/locale.gen ###Show from line 100
less
Less is similar to more, but less supports scrolling up and down content, while more only supports line-by-line display.
The code is as follows:
$ less /etc/locale.gen
$ less +100 /etc/locale.gen
nano
Nano is a simple and useful text editor that is easy to use.
The code is as follows:
$ nano filename ##Edit filename file, if file does not exist, open a new file, if save when exiting, create file
After editing, ctrl + X prompts whether to save, press y to save.
Note: ctrl + G can be used to get help during use.
"Linux basic file operation command" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.