Ten Linux commands that are rarely known-Part 3

Source: Internet
Author: User

In order to enter the third part of the 10 little-known Linux commands, it is worth understanding. Maybe you already know these commands, so you are undoubtedly an experienced Linux user who is interested in exploring them.

22. ^ foo ^ bar command

Run the last modified command in an instance. Suppose I need to run a command 'LS-l' to list the content in the 'desktop 'directory in detail. Unexpectedly, you hit 'lls-l '. So you need to repeat the entire command or use the navigation key to edit the previous command. This is very painful when your command is very long.

Bkjia @ localhost :~ /Desktop $ lls-l
Bash: lls: command not found

Bkjia @ localhost :~ /Desktop $ ^ lls ^ ls

Ls-l
Total 7489440

Drwxr-xr-x 2 bkjia 36864 Nov 13 2012 101 MSDCF
-Rw-r -- 1 bkjia 206833 Nov 5 1.jpg
-Rw-r -- 1 bkjia 158951 Nov 5 2.jpg
-Rw-r -- 1 bkjia 90624 Nov 5 Untitled 1.doc

Note: In the above replace, we use "typo (replaced) original_command (original Command )". Warning! This command may be very dangerous! If you intentionally or unintentionally error system commands or any risky commands like rm-rf!

23.> file.txt command

This command will refresh the file content without deleting and then create the same file. This command is useful when we need to output multiple times or record logs on the same file.

I have a lot of text 'test.txt 'files on my 'desktop.

Bkjia @ localhost :~ /Desktop $ cat test.txt

Linux
GNU
Debian
Fedora
Kali
Ubuntu
Git
Linus
Torvalds


Bkjia @ localhost :~ /Desktop $> test.txt
Bkjia @ localhost :~ /Desktop $ cat test.txt

Note: again, this command may be dangerous! Never refresh the system file or the content of a log file. If you do this, you may encounter serious problems!

24. at command

The 'at' command is similar to the cron command and can be used to schedule a task or execute a command at a specific time.

Bkjia @ localhost :~ /Desktop $ echo "ls-l>/dev/pts/0" | at 14:012

Or

Bkjia @ localhost :~ /Desktop $ echo "ls-l>/dev/pts/0" | at 2: 12 PM

Sample output

-Rw-r -- 1 bkjia 220492 Nov 1 Screenshot-1.png
-Rw-r -- 1 root 358 Oct 17 10:11 sources. list
-Rw-r -- 1 bkjia 4695982080 Oct 10 squeeze. iso
..
..
-Rw-r -- 1 bkjia 90624 Nov 5 Untitled 1.doc
-Rw-r -- 1 bkjia 96206 Nov 5 Untitled 1.odt
-Rw-r -- 1 bkjia 9405 Nov 12 Untitled.png

Note: echo "ls-l" means to output this string of commands (here ls-l) to the standard terminal. You can replace 'LS-l' with the command you need or select '.

>: Redirected output

/Dev/pts/0: This is the output device and/or file, which is output to the specified place. Here it is output to the terminal (/dev/pts/0 ).

For me, my tty is at/dev/pts/0. You can run the tty command to check your tty.

Bkjia @ localhost :~ /Desktop $ tty

/Dev/pts/0

Note: 'at' will be executed as soon as the system time matches to a specific time.

For more details, please continue to read the highlights on the next page:

Ten Linux commands that are rarely known-Part 2

11 Linux commands that are rarely known but useful

Linux Command cd

Cat for Linux commands

Linux Command alias/unalias

Linux Command Parsing: su root and su-root

Interactive input of Linux commands read

File Processing commands for Linux commands

  • 1
  • 2
  • Next Page

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.