Common Linux commands: nslookup, lsmd5sum, uname, and history

Source: Internet
Author: User
Tags domain name server name server lookup nslookup ssh server

Common Linux commands: nslookup, lsmd5sum, uname, and history
1. nslookup

DNS developers all know what the nslookup (name server lookup: domain name query) command is for. It comes with windows. However, in Linux, enter nslookup to display the command not found. DirectYum install nslookup, Error. Find the software package that provides the command. ExploitationYum provides */nslookupYou can find the required software package.

If you know the software package, useYum install-y bind-utilsInstall it.

Query DNS domain name server information:

Query email switch records:

Query Domain Name Server:

Query DNS records:

Query the starting authority:

Query the port number (not found here ):

For more information, see: 8 Linux Nslookup Commands to Troubleshoot DNS (Domain Name Server)

2. ls

This command is used to List Directory Contents (List Directory Contents), which may be files or folders.

"Ls-l(Long listing fashing) command to list the contents of a folder in detail mode.

The "ls-a" command lists all the content in the folder, including hidden files starting.

"Ls-l"

3. md5sum

Md5sumIt is used to calculate and verify the MD5 information signature. MD5 checksum uses a match to verify the integrity of the file.

4. uname

This command is short for Unix Name and displays detailed information about the machine Name, operating system, and kernel.

5. history

This command records the history. It displays the history of all commands executed in the terminal.

6. sudo

"SudoThe (super user do) command allows authorized users to execute commands of super management users or other users.

Note:SudoAllows users to borrow superuser permissions whileSuThe Command actually allows the user to log on as a Super User, soSudoRatioSuMore secure.

"To err is human, but to really foul up everything, you need root password ."

"No one can beat it, but having a root password is a real battle ."

7. su

You can use this command to switch users,SuIs the abbreviation of switch user. To switch from a common user to a root user, you need to enter the root password. to switch from a root user to a common user, you do not need to enter the password.

Su leeSwitch to the lee user.

SuSwitch to the root user.

8. mkdir

Mkdir(Make directory) command to create a new directory under the named path. If the directory already exists, an error message is returned: cannot create folder, folder already exists.

Note: A directory can only be created under a directory with write permission. In linux, files, folders, drivers, commands, and scripts are regarded as files.

9. mkpasswd

This command generates a random password that is difficult to guess based on the specified length. -L indicates the Length ). For example, a 15-bit random password is generated.

10. date

This command uses standard output to print the current date and time. For more command settings, you can useDate -- helpCommand.

 

11. cp

Copy. This Command copies the file from one place to another.

If you use this command directly, the prompt "omitting directory" appears. This is because there is a directory in lee_dir and it cannot be copied directly. ExploitationCp -- helpCheck that there is a parameter to solve this problem. -R (recursive), copy directories recursively (recursive copy directory ).

12. pwd

This command displays the full path of the current working directory on the terminal.PwdPrint working directory.

 

13. cd

This command changes the directory. It changes the working directory in the terminal to perform replication, movement, read, write, and so on. For example"Cd ~"The working directory will be changed to the user's home directory ,"Cd .."Indicates switching from the current directory to the parent directory of the current working directory.

14. cal

Cal(Calender), which is used to display the current month or the month in the future or any past year.

15. chmod

"Chmod"Command is to change the mode bit of the file. It will change the file mode (permissions) of each given file, folder, script, and so on as required ). There are three types of permissions in the file:

Read (r) = 4

Write (w) = 2

Execute (x) = 1

If you only want to grant the File Read-Only permission, set it to "4"; write permission, set it to "2"; execute permission only, set it to "1"; read and write permission, 4 + 2 = 6, and so on.

Now you need to set three user and user group permissions. The first is the owner, the group where the user is located, and the last is another user.

Rwxr-x -- x abc. sh

Here, the root permission is rwx (read/write and execution permissions)

The User Group permission is r-x (read and execute permissions)

Other user permissions are-x (only execution permissions)

To change its permissions, read, write, and execute permissions are provided for the owner, user group, and other users:

Chmod 777 abc. sh

All three methods only have read and write permissions:

Chmod 666 abc. sh

The owner user has the read/write and execution permissions. the user's group and other users only have the executable permissions:

Chmod 711 abc. sh

16. useradd

Create a user account. After the account is created, use password to set the account password, and use userdel to delete the account. The account created using the useradd command is actually saved in the/etc/password text file.

"Useradd xiaoliang-p 45678900"Create a user xiaoliang with a password of 45678900

17. chown

This command changes the file owner and user group. Each file belongs to one user group and one user. Use the "ls-l" command to see the following.

The file leo. sh belongs to the user and user group "root". The first root represents the user, and the last root represents the user group.

Chown lee: root leo. shChange the owner of the leo. sh file to lee and the user group to root.

18. ifconfig

This command is used to configure the network interface information of the resident kernel.

19. netstat

This command displays various network-related information, such as network connections, route tables, interface statistics, disguised connections, and multicast member identities.

Netstat-List all Network Ports

Netstat-at: Display All TCP-related ports

Netstat-sDisplay statistics of all connections

20. uptime

This command is used to query the linux system load. The average system load is defined as the average number of processes in the running queue within a specific interval.

If a process meets the following conditions, it will be in the running queue:

  • It has no results waiting for I/O operations
  • It does not take the initiative to enter the waiting status (that is, it does not call 'wait ')
  • Not stopped (for example, waiting for termination)

1. The current time is 10:43:18

2. The system has run.

3. Current online user 1 user

4. The average load is 0.00, 0.01, and 0.05, indicating the system load for 1 minute, 5 minutes, and 15 minutes, respectively.

In addition, this command also has a parameter-V (uppercase) to query the version:

21. wall

This command can send information to all users logging on to the system.

If you send a message to a user who has logged on to the system, you can useWriteThis command.

22. service

This command controls the start, stop, and restart of the service. This command can enable, stop, or restart a service without restarting the entire system.

For exampleService network restart, Restart the NIC.

23. rm

Remove command. It can be used to delete files and directories.

Since mm.txt is used directlyMkdirCommand, so it is a folder.RmThe command cannot directly Delete the directory. You need to add Parameters-Rf. -R indicates recursive, and-f indicates force.

24. touch

Create a new file that does not exist or modify the file timestamp.

25. Show All Users

getent passwd

26. View jdk

yum list *jdk*

27. Install jdk

yum install *jdk*

Install JRE and JDK

# yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel

28. query which version of git is installed

rpm -qa git

29. error: syntax error near unexpected token '$' {\ r''

[root@leo platform_build]# sh envsetup.shenvsetup.sh: line 1: syntax error near unexpected token `$'{\r'''nvsetup.sh: line 1: `function hmm() {

Because the file line breaks are in dos format "\ r \ n"
You can use the cat-v file name to check whether the line break is. If the above is used, the end of the line will be ^ m
Convert to "\ n" in linux/unix format"
The specific conversion method is to convert line breaks
You can use the sed command to process the file. The command is as follows:

Sed's/\ r // 'original File> converted file

For example

sed 's/\r//' envsetup.sh >envsetup1.sh

30. Search for and install the appropriate JDK version in Ubuntu

apt-cache search openjdk

Install

sudo apt-get install openjdk-7-jdk

31. Configure the java_home variable in ubuntu

Run directly

echo $JAVA_HOME

The output cannot be seen.

Settings:

echo export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64/" >> ~/.bashrc

Restart terminal or use the following command

source ~/.bashrc

Output $ JAVA_HOME again

32. Check which program uses a port

lsof -i:3306

33. cat commands have three main functions

1. display the entire file at a time

2. Create a file from the keyboard

3. Merge several files into one

cat filename
cat > filename
cat file1 file2 > file

34. SSH Server is not installed in Ubuntu by default.

sudo apt-get install openssh-server

Restart After configuration is complete

sudo /etc/init.d/ssh restart

35. decompress the tgz file (use tar to compress the file with the gzip command)

tar zxf filename
X: Extract files from the tar package z: indicates that the tar package is compressed by gzip. Therefore, you need to decompress the package using gunzip. v: displays detailed information.
F: f must be followed by the file name to be processed

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.