Common Commands for Linux Beginners

1. Add user: useradd mylinux

       passwd mylinux

      Add your user password

2. Switch user:

  su otheruser (note that this switching method is only temporary, the essential working directory is still in the original user directory, take a look at the output path: echo $PATH)

  su - otheruser (this is to switch all to another user environment)

  sudo enter your command here (this is temporarily using root privileges to do some commands, such as shtdown -r now, setup)

  passwd modifies the root password by default

3. Find the command

  find: the most powerful search, the disadvantage is that it is very slow, the usage find / (represents the search under the root path) -name (search by name) 'nginx.conf'

  locate : very fast search, it is read from the database, you can find the exact path, usage: locate nginx.conf

  whereis : is also fast, but it looks for what you type in front of, fuzzy matching locate nginx .conf  (conf will be ignored)

  Use the which command to check whether the system command exists and return the location of the system command. Use the which command to check whether the grep command exists and the existing directory. The command is "which grep".

       The type command checks whether a command in the system is a built-in command of the system. Use the type command to check whether the cd command is a built-in command of the system; check whether the grep command is a built-in command of the system.

4, print the text content: cat, edit the text: vi vim create a file: touch, start the service: service mysql start/status (check the status)

 

Guess you like

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