Linux beginners need to learn the summary of commands

  
                

Using Linux commands can do most of the work. Linux can't do without commands. So there are so many Linux commands, which ones must be mastered by beginners? The following small series will introduce you to the commands that Linux developers must learn.

Linux commands can effectively accomplish a lot of work, such as disk operations, file access, directory operations, process management, file permissions settings. To truly understand the Linux system, you must learn from Linux commands and learn more about Linux systems through basic command learning.

The number of commands for different Linux distributions is different, but there are more than 200 commands for Linux distributions. Here, the author divides the more important and frequently used commands into the following six parts according to their role in the system.

◆ Installation and login commands: login, shutdown, halt, reboot, install, mount, umount, chsh, exit, last;

◆ File processing commands: file, mkdir, grep, dd , find, mv, ls, diff, cat, ln;

◆ System management related commands: df, top, free, quota, at, lp, adduser, groupadd, kill, crontab;

◆ Network operation commands: ifconfig, ip, ping, netstat, telnet, ftp, route, rlogin, rcp, finger, mail, nslookup;

◆ System security related commands: passwd, su, umask, chgrp, Chmod, chown, chattr, sudo ps, who;

◆ Other commands: tar, unzip, gunzip, unarj, mtools, man, unendcode, uudecode.

This article uses Mandrake Linux 9.1 (Kenrel 2.4.21) as an example to introduce the installation and login commands under Linux.

login

1. Role

The role of login is to log in to the system. Its usage rights are all users.

2.Format

login [name][-p ][-h hostname]

3. Main parameters

-p: notification login Maintain current environmental parameters.

-h: Used to transfer usernames between remote logins.

If you choose to log in to Linux with command line mode, then the first Linux command you see is login:.

The general interface looks like this:

Manddrake Linux release 9.1(Bamboo) for i586

renrel 2.4.21-0.13mdk on i686 /tty1

Localhost login:root

passWord:

In the above code, the first line is the Linux distribution number, the second line is the kernel version number and the login virtual console, we are in the third line Enter the login name and press the “Enter” key to enter the account password after the password to log in to the system. For security reasons, characters are not echoed on the screen when the account password is entered, and the cursor does not move.

After logging in, you will see the following interface (take superuser as an example):

[root@localhost root]#

last login:Tue ,Nov 18 10: 00:55 on vc/1

The above shows the login day, month, day, time and virtual console used.

4. Application Tips

Linux is a true multi-user operating system that can accept multiple users to log in at the same time, and allows one user to log in multiple times. This is because Linux, like many versions of Unix, provides access to the virtual console, allowing users to log in multiple times at the same time from the console (the system's console is the monitor and keyboard directly connected to the system). Each virtual console can be thought of as a separate workstation that can be switched between workbenches. The virtual console can be switched by pressing the Alt key and a function key, usually using F1-F6.

For example, after the user logs in, click the <quo;Alt+F2” button, and the user will see the “login:” prompt that appears above, indicating that the user has seen the second virtual console. Then just press the <quo;Alt+ F1” key to go back to the first virtual console. A newly installed Linux system allows users to access the first six virtual consoles using the <Alt+F1” to “Alt+F6” keys. The most useful thing about the virtual console is that when a program error causes the system to deadlock, you can switch to another virtual console to work and close the program.

shutdown

1. Function

The shutdown command is used to shut down the computer. Its usage rights are superusers.

2.Format

shutdown [-h][-i][-k][-m][-t]

3. Important Parameters

-t: Tells the init program how long it will shut down before changing to other runlevels.

-k: It doesn't really shut down, just send a warning signal to each registrant.

-h: Turn off the power after turning off the power.

-c:cancel current PRocess cancels the shutdown program currently being executed. So of course there is no time parameter for this option, but you can enter a message for explanation, and this message will be sent to each user.

-F: Force fsck when restarting your computer.

-time: Set the time before shutdown.

-m: Change the system to single-user mode.

-i: Display system information when shutting down.

4. Command Description

The shutdown command safely shuts down the system. Some users will shut down the Linux system by directly disconnecting the power supply, which is very dangerous. Because Linux is different from Windows, it runs many processes in the background, so forcible shutdown may result in data loss of the process, making the system unstable, and even in some systems, the hardware device (hard disk) will be damaged. Use the shutdown command before the system is shut down. The system administrator will notify all logged-in users that the system is shut down, and the login command will be frozen, that is, the new user can no longer log in.

halt

1.

The role of the halt command is to shut down the system. Its usage rights are superusers.

2. Format

halt [-n] [-w] [-d] [-f] [-i] [-p]

3. Main parameters Description

-n: Prevents sync system calls. It is used after patching the root partition with fsck to prevent the kernel from overwriting the patched superblock with the old version of the superblock.

-w: It's not really a reboot or shutdown, just write a wtmp (/var/log/wtmp) record.

-f: Did not call shutdown, but forced shutdown or restart.

-i: Turn off all network interfaces before shutting down (or rebooting).

-f: Force shutdown, do not call shutdown command.

-p: When the power is turned off, the power is turned off.

-d: Shut down the system, but leave no records.

4. Command Description

halt is to call shutdown -h. When halt is executed, it kills the application process, executes sync (forces the data stored in the buffer to the hard disk), and stops the kernel after the file system write operation is completed. If the system's run level is 0 or 6, shut down the system; otherwise, replace it with the shutdown command (plus the -h parameter).
Previous123Next page Total 3 pages

Copyright © Windows knowledge All Rights Reserved