Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux simple commands     - Making Linux root file system problems on-link library (Programming)

- Python image processing library (PIL) to install and simple to use (Linux)

- Oracle 11gr2 new APPEND_VALUES tips (Database)

- TOAD connect DB2 error SQL1460N solve (Database)

- RPM package creation Getting Started (Linux)

- ACL permissions Linux command (Linux)

- VMware installed Linux system and JDK deployment (Linux)

- How to disable IPv6 in the CentOS 7 (Linux)

- imp / exp Oracle Database import and export commands (Database)

- Change all child files and subdirectories in the owner permissions Ubuntu (Linux)

- RHEL 6.5 x86_64 CentOS yum configuration source (Linux)

- Oracle View Object Information (Database)

- Install Ubuntu 14.04 and Windows 8 / 8.1 dual-boot in UEFI mode (Linux)

- Depth understanding of the use of Spring Redis (Programming)

- Eclipse distributed management using GitHub project development (Linux)

- Use MD5 transform algorithm to prevent exhaustive decipher passwords (Linux)

- Increase Linux system security --chattr (Linux)

- Linux use iptables ban Ping (Linux)

- Reported too many open files Linux solutions (Server)

- Linux system on a virtual machine to access the Internet (Linux)

  Linux simple commands
  Add Date : 2018-11-21      
  Some simple Linux command finishing

1.who command: displays the user name currently logged on the system, terminal name, login and system time.

2.who am i command: Displays the current login terminal.

3.date command: Displays the current system date and time.

4.cal command: shows the current month's calendar, for example:

cal 8 2008 shows the August 2008 Calendar

cal 2008 | more split screen display, press the spacebar to display the next screen

5.pwd command: Displays the file path name

6.ls command: Lists all the files in the current directory

ls -l normally-list lists the files in the current directory

ls -a displays detailed information about all files, including hidden files

ls -h

7.cat command displays the contents of a file, such as cat ex1

Merge the contents of two files and save it to a third file with the command:

cat ex1 ex2> tax1

more command-by-screen display file contents, such as: more tax1

rmdir delete subdirectories

mkdir directory name to create a new directory

rm delete directory directory name

rm -r directory name recursively delete a directory of all the files and the directory itself.

rm -rf directory name recursively delete a directory of all the files and the directory itself without confirmation.

cp source file name of the target file name to copy files

mv source file name of the target file name to rename a file

find the file name you find files by file name

chmod change file permissions, basic usage: chmod g + w Hello.cpp, that is, modify the permissions for the same group of users under writable.

wc -l file name of a file to view the number of firms

wc -c file name of a file to view how many bytes

8.shell command

Build script with the vi editor, such as vi ex4 its input at a command prompt is:



ls -l

This will create the script, and then there are three ways to execute the command:

(1) with the command sh < ex4 script execution

(2) to be directly sh ex4

(3) the script as a command is executed, the script to change permissions with chmod, that chmod a + x ex4

This can be performed inside the vi editor commands.

You can also directly enter the absolute pathname of the executable file, first with the pwd displays the current file paths, and then you can enter the absolute pathname execution.

man command command name can view the online help information.

9.shell variable

Variable (1) User-Defined

Format: variable name = string variable name and a string note there are no spaces

To add $ before a variable name using a variable name

For example: m = Hello then echo $ m can be represented by a string variable shows.

(2) using the read command to the variable assignment

Format: read variable 1 variable 2 ...............

Such as: read x1 x2 press Enter

Then enter 123 456

Put 123 assigned x1,456 assigned x2

Then echo $ x1 $ x2 can display the values of x1 and x2

Note: If the number of variables is less than the number of data, the last variable takes all the remaining data values. If more variables than the number of data, the

There is no corresponding data variables to take an empty string.


read x y z


echo $ x $ y output 12

echo $ z output 345

read x y z


echo $ x $ y $ z z output 12 that is empty

10. The shutdown command: shutdown

In some common linux shutdown / restart commands are shutdown, halt, reboot, and init, they can achieve the purpose of restarting the system, but the internal work processes each command is different, by this introduction, I hope you can be more flexible application of the shutdown command.

(1) shutdown

shutdown command to shut down the system safely. Some users will use a direct way to cut off the power supply shut down linux, which is very dangerous. Because linux and windows is different from its many processes running in the background, so the forced shutdown process may result in data loss, so that the system is in an unstable state, and even in some systems may damage the hardware. And before the system shutdown using the shutdown command, the system administrator will notify all registered users of the system will be shut down. And login instructions will be frozen, that new users can not log on. Direct shutdown or delay some time before shutdown is possible, may also restart. This is caused by all processes [process] will receive the system served signal [signal] decision. This allows a program like vi and the like have time to save the current document being edited, and image processing program and e-mail [mail] News [news] is you can normally leave and so on. shutdown perform its job is to send a signal [signal] to the init process, asking it to change the runlevel. Runlevel 0 is used to shut down [halt], runlevel 6 is used to re-activate [reboot] system, and runlevel 1 is to be used to put the system into state management work can be carried out; this is the default, assuming no -h nor -r parameter to shutdown. To understand the shutdown or reboot [halt] [reboot] process to do what action, you can see these runlevels relevant information in the file / etc / inittab Lane.

shutdown parameters:

[-t] Before changing to another runlevel, tells init how long after the shutdown.

[-r] To restart the calculator.

[-k] Does not really shutdown, only to send warning signals to each enrollee [login].

[-h] [Halt after shutdown power off].

[-n] Do not init, but their own to shut down. We do not encourage the use of this option, and the consequences of this option is often not always what you expect to receive.

[-c] Cancel current process to cancel the shutdown process is currently being executed. So this option of course is no time parameter, but you can enter a message to explain, and this information will be sent to each user.

[-f] Ignored fsck on reboot calculator [reboot].

[-F] Forced fsck on reboot calculator [reboot].

[-time] [Shutdown] time setting off before.

(2) halt-- easiest shutdown command

In fact, halt is to call shutdown -h. When halt execution, kill the application process, the implementation of sync system call, file system write operation will stop after the completion of the kernel.

Parameter Description:

[-n] To prevent the sync system call, which is used after repair with fsck the root partition, to prevent the kernel with the old version of the super-block superblock] [coverage patched superblock.

[-w] Is not really restart or shut down, just write wtmp [/ var / log / wtmp] record.

[-d] [Do not write wtmp record is included in the options [-n] in].

[-f] Do not call shutdown forced shutdown or restart.

[-i] [Before shutdown or restart], turn off all network interfaces.

[-p] This option is the default option. It is to call poweroff shutdown.

(3) reboot

Working Process reboot halt with almost the same, but it is caused by a host reboot, and halt the shutdown. It's almost the same parameters and halt.

(4) init

init is the ancestor of all processes, its process number is always 1, it will send a TERM signal to the init process terminates all user , daemons. shutdown is the use of this mechanism. init defines eight runlevel (runlevel), init 0 for the shutdown, init 1 to restart. About init can be lengthy, there is no longer narrative. Another telinit command can change the run level init, for example, telinit -iS makes the system into single-user mode, and the lack of information when using the shutdown and the waiting time

Use a semicolon (;) can be separated from the two commands, so you can achieve more than one command line, enter at any time into the command, you can press < Tab> key, when this is done, the system will attempt to complement this time command that was entered. If the string has been input is not sufficient to uniquely identify the command that it should be used, the system will sound an alarm. Press < Tab> key, the system will give again available to be used to complete a string list.

11.uname display machine name, add the parameter -a machine for detailed information display. Namely: uname -a

12.ps command: used to display the current process, the default display only the processes that are currently created by the user, if you want to display all system processes, will have to add the -e parameter. That ps -e. After this command is executed, there are a few caveats. PID represents the process ID number, TTY represents the process in which interrupt, TIME represents the time the process of creating, CMD represents the process which created the program.

13.ifconfig command: View card settings.

14.fdisk for disk partitions, fdisk -l to view the current disk partitioning.

15.lsmod command: Viewing the kernel module.

16.modprobe command: load a module into the kernel, modprobe + module name.

17.kill + process ID to kill the process id represents.

18.chgrp modify the file belongs to the user, for example: chgrp root Hello.cpp refers to the file Hello.cpp modify the file under the root user.

19. Create a soft link ln -s file link source file name link

Copy and paste the 20.vi

Copy is selected, the right is the paste, or enter the letters v, vi enter visual mode, and then press the arrow keys to select the selected content,

Then y, showing copy, paste and finally represented by p.

21. CD or U disk loading

mount / dev / sda0 / mnt / floppy

Uninstall: umount / mnt / floppy

Automatically eject the optical drive eject automatically recover the drive eject -t

22. Common Commands

touch command can be used to create the file.

See all environment variables: echo $ PATH

ps -e view the process

ps a view processes that are currently running in the foreground

chsh -l See the Linux shell
- Three kinds of binary tree traversal recursive and iterative solution (Programming)
- Oracle bdump file soaring (Database)
- MySQL Statistics (Database)
- CentOS 7 install Hadoop-cdh-2.5 on Mesos (Server)
- Five programming fallacy (Programming)
- Linux text processing tool of sed (Linux)
- Briefly explain the invasion of the four-level denial of service attack DoS Linux server (Linux)
- Java List add duplicate the same object (Programming)
- To install Cinnamon desktop environment on your Ubuntu 14.04 / 12.04 (Linux)
- Using open source software to build XWiki Wiki system installed within the company (Linux)
- Android studio multi-channel ultra-compact version of the package (Programming)
- Linux remote connectivity tools -OpenSSH (Linux)
- OpenSUSE installation on CentOS6 (GUI) (Linux)
- How to contribute code to the GNU Project (Linux)
- Hadoop 2.0 Detailed Configuration Tutorial (Server)
- Hadoop connection failed or stuck processing (Server)
- OS X CAOpenGLLayer how to enable OpenGL 3.2 core profile (Programming)
- CentOS 6.5 opens the Xmanager Remote Desktop login (Linux)
- shell script: MySQL startup script simple (Database)
- How to create a cloud encrypted file system in Linux systems (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.