Linux operating system shell command line tips sharing

  
                             In the Linux system, the command is used to install, configure, and so on. In other words, if you are familiar with the Linux command line, you can actually use the system. In the command line operation of Linux, there are a lot of very effective tips that can be applied to daily operations, and get twice the result with half the effort. Here are a few tips.
$ mv thisisareallylongfilename{,.txt}
This command will rename the file "thisisareallylongfilename" to "thisisareallylongfilename.txt", so you don't have to double this long file name, although there is in the shell The tab button automatically fills in the file name. This tip doesn't seem to be very useful, but it is still very useful in shell scripts.
$ mv foo.{jpeg,jpg}
This command will rename foo.jpeg to foo.jpg. Some extended characters in the shell are often overlooked. For example, you need to enter all the characters of the previous command, you can use !! to achieve:
$ ~/foo.sh-bash: /home/lveyo/foo.sh: Permission denied$ sh !!sh ~/foo.sh
There are other uses: !* will replace all the parameters of the previous command, (!! is the entire command and all parameters) !$ Previous command The last parameter!:3 The third parameter of the previous command is: $ ls /tmp/somedir
ls: cannot access /tmp/somedir: No such file or directory $ mkdir -p !*
mkdir - p /tmp/somedir $ touch 1 2 3 $ cp !:2 /tmp/somedir
cp 2 /tmp/somedir These small tips hope to help everyone, improve the interest in command line operations, walk into the command It’s the way to go into the real world of Linux.

Copyright © Windows knowledge All Rights Reserved