Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ 10 useful Linux command line tips     - Use PDFBox parse PDF file (Linux)

- Manage SQL Server services login (start) account and password (Database)

- MySQL multi-instance configuration (Database)

- Summary Linux operating system some tips to prevent attacks (Linux)

- GNU / Linux enable Intel Rapid Start (Linux)

- Getting Started with Linux system to learn: how to install the Shrew Soft IPsec VPN on Linux (Linux)

- To compile and install Clang 3.5.0 in Linux CentOS (Linux)

- Make command Detailed Tutorial (Programming)

- How to use Linux iptables tool for network sharing (Linux)

- Detailed Linux network security policies and protection measures (Linux)

- Turning off the interface eth0: error: Disconnect the device 'eth0' (Linux)

- Struts2 configure a static resource files without Struts processing (regular match) (Programming)

- Red Hat Enterprise Linux configuration VNC multi-user access methods (Linux)

- Linux rights management (Linux)

- RAID disk array Description (Linux)

- Android project using the command to create and install the package (Programming)

- BackTrack (BT3, BT4) Linux installation tutorial (Linux)

- How to create a binary distribution with Bash (Linux)

- CentOS 6 rapid deployment of Java applications (Linux)

- Three kinds of implementation model of the Linux thread history (Programming)

 
         
  10 useful Linux command line tips
     
  Add Date : 2018-11-21      
         
       
         
  I remember the first time I use Linux, I also used Windows graphical interface, I really hate Linux terminal. At that time I think the command is difficult to remember, you can not use them correctly. Over time, I realized that the beautiful, flexible and availability Linux terminal, to be honest, I do not have a day without using it. Today, I am very happy and just getting started with Linux people together to share some useful tips and hints, hoping to help them better transition to Linux, and help them to learn something new (hopefully).

10 Linux command line tips

5 interesting Linux command line tips
Management Linux file types five useful commands
This article hopes to show you some does not require high technology can be used in the same master as a helpful tips Linux terminal. You only need a Linux terminal and some free time to appreciate these commands.

1. Locate the correct command

Execute the correct command for your system is very important. However, there are so many, it is difficult to remember a variety of command line in Linux. So how do you find the right commands you need it? The answer is apropos. You only need to run:

# Apropos
Where you want to use really describe what you want to find a command statement instead of "description". Here is an example:

# Apropos "list directory"
dir (1) -list directory contents
ls (1) -list directory contents
ntfsls (8) -list directory contents on an NTFS filesystem
vdir (1) -list directory contents
On the left you can see is the command, the right is their description.

2. Run previous command

Many times over and over again you need to execute the same command. Although you can press the up cursor keys on your keyboard, but you can also use an alternative command history. This command lists since the last time you had to start all the input terminal command:

# History
1fdisk-l
2apt-get install gnome-paint
3hostname tecmint.com
4hostnamectl tecmint.com
5manhostnamectl
6hostnamectl - set-hostname tecmint.com
7hostnamectl-set-hostname tecmint.com
8hostnamectlset-hostname tecmint.com
9mount-t "ntfs" -o
10fdisk-l
11mount-t ntfs-3g / dev / sda5 / mnt
12mount-t rw ntfs-3g / dev / sda5 / mnt
13mount-t -rw ntfs-3g / dev / sda5 / mnt
14mount-t ntfs-3g / dev / sda5 / mnt
15mountman
16manmount
17mount-t -o ntfs-3g / dev / sda5 / mnt
18mount-o ntfs-3g / dev / sda5 / mnt
19mount-ro ntfs-3g / dev / sda5 / mnt
20cd / mnt
...
As you can see above, you'll get a list of commands that you have run. Each row has a number that you enter in the first few lines of command. You can re-invoke the command the following methods:

! #
The actual number of which command to use instead of #. To better understand, look at the following example:

! 501
Equivalent to:

# History
 
3. Use the command midnight

If you are not accustomed to using similar cd, cp, mv, rm commands, you can use the command midnight. It is a simple visualization shell, you can use the mouse in the above:

Midnight command

With the F1 to F12 keys, you can easily perform different tasks. Only need to select the corresponding command at the bottom. To select a file or directory, press the "Insert" key.

Briefly midnight is called "mc". To install mc, just run:

$ Sudoapt-get install mc [OnDebian based systems]
#yum install mc [OnFedora based systems]
Here is a simple example of the use of midnight commander. Open mc by entering the following command:

# Mc
Now use the TAB key to select a different window - left and right. I want to move to a "Software" directory LibreOffice files:

Midnight command to move files

Press the F6 button to move the file a new directory. MC will ask you to confirm:

Move the file to a new directory

After confirmation, the file will be moved to the new destination directory.

Further reading: How to Use Midnight command file manager in Linux
 

4. Turn off the computer at a specified time

Sometimes you need to work a few hours and then turn off the computer. You can turn off your computer at a specified time by using the following command:

$ Sudoshutdown21: 00
This will tell you in your designated time to shut down the computer. You can also tell the system to shut down after a specified minutes:

$ Sudoshutdown + 15
This means that the computer will shut down after 15 minutes.

5. The user's information is known

You can use a simple command to list the users of your Linux system and some basic information about them.

# Lslogins
This will output the following results:

UID USER PWD-LOCK PWD-DENY LAST-LOGIN GECOS
0 root 00Apr29 / 11: 35 root
1 bin 01 bin
2 daemon 01 daemon
3 adm 01 adm
4lp01lp
5sync01sync
6shutdown01Jul19 / 10: 04shutdown
7halt01halt
8 mail 01 mail
10 uucp 01 uucp
11operator01operator
12 games 01 games
13 gopher 01 gopher
14 ftp 01 FTP User
23 squid 01
25 named 01Named
27 mysql 01MySQLServer
47 mailnull 01
48 apache 01Apache
...
 

6. Find File

Find files sometimes are not as simple as you think. A good example of a search for files is:

# Find / home / user -type f
This command will search for all files / home / user directory. find command is really powerful, you can pass it to give more options to make your search more detailed. If you want to search for files over a certain size, you can use:

# Find.-type f -size10M
The above command will search the current directory of all the files larger than 10M. Make sure not to run the command in the root directory of your Linux system, because it may cause your machine I / O bottlenecks.

One option I most often find command together with the "exec", which allows you to find the results of the command to run some operations.

For example, if we want to find all the files in a directory and change the permissions. You can complete the following simple command:

# Find / home / user / files / -type f -execchmod644 {} \;
     
         
       
         
  More:      
 
- Based shell: using read, the command-line script to achieve mass participation and input two integer calculation (Programming)
- FastDFS installation and deployment (Server)
- Java to achieve local fileCopy (Programming)
- Service Discovery: Zookeeper vs etcd vs Consul (Server)
- Python function arguments * args and ** kwargs usage (Programming)
- J2EE Example of Filter (Programming)
- Linux device driver development small example --LED lights (Programming)
- The Samba service does not have permission to access (Server)
- Android imageView in the Src and Background (Programming)
- Seven Steps to Help Google Chrome Speed - (Linux)
- Hadoop 2.7.1 Installation and Configuration under RedHat Linux 6.5 (Server)
- How to upgrade to Oracle 11g Oracle 12c (Database)
- Under CentOS Linux automatic backup MySQL database daily (Database)
- Java learning problems encountered (Programming)
- Alternative methods of intrusion bundled executable file new thinking (Linux)
- How VirtualBox and VMware virtual machine conversion (Linux)
- SQLite3 simple operation (Database)
- MariaDB 10.0.X, the dynamic column support JSON format to obtain data (Database)
- Linux Log (Linux)
- jQuery get value drop-down list and select text (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.