In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what CentOS6.5 basic operation commands are commonly used, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
First of all, you can use virtualbox to install a CENTOS6.5 system, or directly purchase a CVM with centos system installed.
Log in to the server to realize remote control
Windows users recommend using Xshell (download address)
Mac users can use the system terminal tools
After logging in to the server, you can start the command line operation.
Check your current location pwd (print working directory)
Pwd
The current location is displayed, for example:
/ root
Change your directory location cd (change directory)
Cd / home
It will take you to the home directory under the root directory. / indicates the root directory. If you check it with pwd, it will return:
/ home
Also cd / root = cd ~
List the things in the catalog ls
Ls
The ls command should be the abbreviation of list, which means listed. This command can be used with some parameters, such as:
Ls-la
This will list the files and directories in a more detailed form, and will include the files hidden in the directory, l for long,an and all. You can specify a specific directory to list after the command, for example:
Ls-la / usr/local
This will list everything in the local directory under the usr directory at the root of the system. If you want to see detailed instructions for the command, you can add the-help parameter:
Ls-help
Now that you have learned a simple ls command to list the things in the directory, you can also use it when using other commands. You know that you can add some parameters to the command to do more specific things. If you want to get instructions for the command, add a-help parameter to the command, and you can also add more specific information after the command, such as the location of a directory. The name of a file and so on.
Create a directory mkdir (make directory)
Mkdir
Below, we can create a new directory in your current location, remember to use the pwd command to determine your location:
Mkdir www
The above command creates a directory called www at the current location. Using the ls command, you can take a look at the contents of the current directory. When installing WDCP, we will create a WWW directory under the root directory to mount the data disk, using the command
Mkdir / www
Delete a directory or file rm (remove)
Rm
After the command, add what you want to delete, which may be the name of a directory or the name of a file. Note that when you want to delete a directory, you need to add two parameters:-r-f, which can be tied together, such as-rf
Rm-rf www
Here, the r parameter allows the rm command to recursively delete the directory and its contents, and the f parameter is force, which means forced deletion. Taken together, this command means to recursively force the deletion of the www directory and everything in that directory.
Edit the file vi:
Vi hello.txt
The above command will edit the hello.txt file in the current directory, and if it does not exist, it will open a blank file so that after you save and exit, you can create a file called hello.txt. The use of the vi tool requires some buttons. For example, after opening the file, if you want to edit the file, you can enter edit mode, press the I key or insert key on the keyboard, and then use the up and down keys to browse to a location in the file. After editing, press the esc key to exit edit mode, and then enter: (colon), and then enter wq to save and exit. If you do not want to save your changes, you can type: Q. Sometimes, when editing some read-only files, you need to add another!, such as: wq!, or Q!.
I, enter the editing mode.
Esc, exit mode.
: wq, save the file and exit.
: wqstores, force save and exit.
: Q, exit directly without saving the changes.
/, you can search, add the text you want to search after /, and then enter.
N, you can find the next place.
N, you can find the previous place.
Ctrl+f, turn the page back.
Ctrl+b, turn the page forward.
For detailed instructions, you can see the help of the vi command, vi-help.
Move / rename directory or file mv (move)
Move or rename a directory or file using the same command:
Directory / file to be moved by mv directory / file after move
After this, it refers to the location of the directory or file you must want to move, a space, followed by the location of the moved directory and file. Here we have to understand the meaning of several paths:
/
Represents the root directory of the system.
~
Represents the home directory of the user currently logged in.
.
A dot represents the current directory.
.. /
Two dots plus a slash to indicate the directory at the next level.
.. /.. /
Represents the upper two-level directory. Knowing this, we can move directories or files.
Mv www www1
The above command means to rename the www directory in the current directory to www1.
Mv www1.. /
This will move the www1 directory to the directory one level above the current directory, and you can go to the directory one level above the current directory:
Cd.. /
Then list the contents of the catalog:
Ls
Have you seen the www1 directory? You can delete it using the rm command plus the rf parameter:
Rm-rf www1
Use ls again to see if www1 is gone.
The * sign indicates all the files or directories. For example, if you want to move all the directories or files under a directory to a certain place, you can do this:
Mv / home/www/web1/* / home/www/gb1982
The above command will move everything in / home/www/web1 to the / home/www/gb1982 directory.
Copy a directory or file cp (copy)
Where do you copy what cp wants to copy?
For example, there is a hello.txt file under your current directory. If you want to make a copy, the copied file is called hello.bak. You can do this:
Cp hello.txt hello.bak
You want to copy hello.bak to the bottom of a directory:
Cp hello.bak / home/bak
This will copy the hello.bak file into / home/bak. Note that the bak directory must already exist.
To copy a directory, you need to add a-R parameter, which recursively copies the directory and everything in the directory. For example, to make a copy of the www directory, the name of the copied directory is www1:
Cp-R www www1
These are all the contents of this article entitled "what are the common commands for the basic operation of CentOS6.5?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.