Symbol linux command line

The Linux Command Line

by William Shotts

Fifth Internet Edition Available Now!

Designed for the new command line user, this 555-page volume covers the same material as LinuxCommand.org but in much greater detail. In addition to the basics of command line use and shell scripting, The Linux Command Line includes chapters on many common programs used on the command line, as well as more advanced topics.

Released under a Creative Commons license, this book is available for free download in PDF format. Download it here.

The book is available in printed form, published by No Starch Press. Copies may be purchased wherever fine books are sold. No Starch Press also offers electronic formats for popular e-readers.

In addition to English, the printed book is also available in the following languages:

  • Korean: available from BJ PUBLIC
  • Serbian: available from Mikro Knjiga
  • Chinese (Traditional): available from GOTOP
  • Chinese (Simplified): available from PT Press
  • Russian: available from Piter
  • Polish: available from Helion

Find The Linux Command Line at your local library.

Want to translate the Creative Commons version of The Linux Command Line? Please see the Community Translation Policy for details.

The following community translations are now available:

  • ArabicTranslation by Abd Allatif Eymsh
  • Spanish (in progress). Translation by Adriano Sánchez
  • Portuguese (in progress). Translation by Matheus Sales
  • Italian (in progress). Translation by Francesco Cargiuli
  • Romanian (in progress). Translation by Vlad Paval
  • Turkish (in progress). Translation by Herkes için Linux

What Readers Are Saying About The Linux Command Line!

«I have been using Linux for a little over a year. Read as much as I could including Rute, and many others. I have learned more in the first 93 pages of your book than any others. «

«What a great help your book has been for me! I was looking for a book like yours, but I never was able to find one that really walks the reader through the Linux command line in a general sort of way. Do you know of any others? If I recall, there are a lot of books dedicated to shell scripting, but none that are geared to regular command-line use.»

«Fantastic book!! I have recently switched from the legacy OS to Linux and I have been trying to find a distro that mimics this legacy OS in fear of using the terminal. I ran across this book and opened the terminal for the first time. This book teaches you everything you need to know about the shell and does it with ease. It starts by giving you a solid foundation and builds from there. Its simplicity and informative structure is ideal for all new beginners switching to Linux. I am now always on the terminal even for the simplest things. Not only does this build love, but I also get to practice my shell scripting. Great book!!»

«I’ve been enjoying reading the book and have learned a lot from every chapter. Your writing is very clear, and I’ve enjoyed following along with your examples. I’ve skimmed a couple of Linux books before, but never had enough time to really get into them. From those experiences however, I think your book is much clearer and approachable for beginners.»

«WOW! What a great book. It will clearly provide a stepping stone for many people who want to wean themselves off of their GUI habit, or perhaps just «Make the difficult possible.»

«I think one of the greatest assets of the book that most others about Linux don’t have is the conversational tone. I feel like in almost every chapter, there are parts where you lead the reader to ask questions of the material that aren’t necessarily covered.»

© 2000-2021, William E. Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved.

Linux® is a registered trademark of Linus Torvalds.

Источник

Symbol linux command line

Query the number of occurrences of a string str in a target file Use the grep command Use awk tools to be continued Sed command Sed: is an editor and a powerful file processing tool. Sed effect:Used t.

Читайте также:  Для перемещения этой папки нужно обладать правами администратора windows 10

command line tools for linux

[color=orange]du -sh `ls .` for i in G M K; do du -ah | grep 7$i | sort -nr -k 1; done | head -n 11 dir | gvim -[/color] df -k . Show size of current directory in df -h | grep /dev/hda1 | cut -c 4.

Linux command line shortcuts

Jump to the beginning of the line Jump to the end of the line Before deleting the cursor After deleting the cursor Delete a word before the cursor Restart the new command line.

Linux command line example

Reference: Linux command line Daquan find P225 find works with regular expressions and can be used to find files. Example: su P88 su should be a shorthand for switch user to switch users. Example: apt.

Linux command line highlighting

Friends who often use the command line to handle server problems should want to permanently set the command line highlighting effect, you need to modify the .bashrc configuration file. The .bashrc fil.

More Recommendation

Linux command line

Linux command line More articles welcome to visit my blogwww.herobin.top Query the contents of the directory: ls -rw-r–r— Normal user switches to root Create folder mkdir Create cascaded mkdir .

Linux command line tutorial

The general format of the Linux command line Command [long option list] [short option list] [parameter list] Among them, the long option refers to the option of guiding with double horizontal lines, t.

ajax and fetch (media for front-end and back-end interaction)

ajax step: 1. Create an xmlhttprequest instance 2. Make an http request 3. Receive data from the server 4. Update the data on the webpage Advantages and disadvantages: It is programming for MVC, which.

Gym — 101572G_Galactic Collegiate Programming Contest simulation multiset

Subject to the effect: ranking is based on a game that counted more than the title of top-ranking, followed by the less time penalty ranking. A team is ranked k + 1, where k k expressed teams better t.

Maze problem (BFS)

S is the starting point, G is the ending point, # is the wall, * is the road, and the shortest distance from S to G is obtained.

Источник

Symbol linux command line

In Linux, all operations can be operated with a terminal command. When we encounter orders that we don’t understand, we will go to search for engines to search for relevant syntax. But we often see some special symbols, such as — * [] |, these symbols often call people. Some symbols have a very deep meaning, and some are not important.

In this article, I summarized these symbols common meaning and usage together in the command line. This article readers need to know some basic orders such as:ls, cd

Second. Basic symbol introduction

No symbol

Any command consists of a word without a space, the simplest usage of one command is to enter this command directly and execute. for examplels

2. Space

The space before and after the command does not affect the resolution of the command, but as a normal person, we won’t be casually. This article adds only necessary spaces in the command. Everyone should easily judge the position of the space when using the code, and do not explain it here.

3. Dollar sign $

At this time, everyone asked,lsfront$It is a command to start what you start, do not need to be played by us. And those who don’t have$The text of the beginning is the meaning of the output.

If all commands consist of a word, then the command we need to remember is too much, so in many times, we need parameters to use more flexible. for examplels -a

4Journal of English.

ls -aIt is used to display hidden files. Among them, single point . That is, the meaning of the date in English is the current directory. Two points.. It means superior files. A potential. The file that starts is a hidden file.

5. minus sign —

The first parameters of one of the commands are generally started with minus, followed by the parameters itself. But sometimes we need two parameters, such asls -al

When we have two or more parameters, we can only write a minus, such asls -al,or ls -a -lls -l -als -laThey are all the same meaning, the order of the parameters does not affect the execution of the command.

3. File Directory Collection Sign

In Linux, there are many commands that need to operate the bulk file. We can enter one by one, but if the number of files is too large, this is obviously unrealistic. Here I introduce some symbols indicating the set of files.

Читайте также:  Образ для флешки mac os x mavericks

Styard *

In the file system,* Is any meaning.* You can connect to any string or another.**Indicates that can be 0 files or multiple files. for example ls *.py

Here I want to talk about it, the parameters behind a command are not necessarily starting with a minus, and the opening is some fixed parameters. It is not the result of some files that have changed.

2. Brand []

In the middle brackets must be paired, and the brackets represent a collection, but also indicates that the characters in this collection must appear once. for example ls [abcl]*.py

3. The minus sign in the middle brackets [-]

The minus sign in brackets represents a range of symbols in which the range is used for ASCII. For example, LS [A-Z] *. Py

4. The file in English in English.

The number in English. The file that starts to indicate the hidden file. by default * Does not include. At the beginning. For example, LS. [1-z] *

5. Wave number

User main directory. for example cd

Please refer to:Some special symbols in the Linux command(Detailed the difference between the Linux command;, |, &&&, ||?)

Источник

10 Amazing and Mysterious Uses of (!) Symbol or Operator in Linux Commands

The ‘!’ symbol or operator in Linux can be used as Logical Negation operator as well as to fetch commands from history with tweaks or to run previously run command with modification. All the commands below have been checked explicitly in bash Shell. Though I have not checked but a major of these won’t run in other shell. Here we go into the amazing and mysterious uses of ‘!’ symbol or operator in Linux commands.

1. Run a command from history by command number.

You might not be aware of the fact that you can run a command from your history command (already/earlier executed commands). To get started first find the command number by running ‘history‘ command.

Now run a command from history just by the number at which it appears, in the output of history. Say run a command that appears at number 1551 in the output of ‘history‘ command.

And, it runs the command (top command in the above case), that was listed at number 1551. This way to retrieving already executed command is very helpful specially in case of those commands which are long. You just need to call it using ![Number at which it appears in the output of history command].

2. Run previously executed command as 2nd last command, 7th last command,etc.

You may run those commands which you have run previously by their running sequence being the last run command will be represented as -1, second last as -2, seventh last as -7,….

First run history command to get a list of last executed command. It is necessary to run history command, so that you can be sure that there is no command like rm command > file and others just to make sure you do not run any dangerous command accidentally. And then check Sixth last command, Eight last command and Tenth last command.

Run Last Executed Commands By Numbers

3. Pass arguments of last command that we run to the new command without retyping

I need to list the content of directory ‘/home/$USER/Binary/firefox‘ so I fired.

Then I realized that I should have fired ‘ls -l‘ to see which file is executable there? So should I type the whole command again! No I don’t need. I just need to carry the last argument to this new command as:

Here !$ will carry arguments passed in last command to this new command.

Pass Arguments of Last Executed Command to New

4. How to handle two or more arguments using (!)

Let’s say I created a text file 1.txt on the Desktop.

and then copy it to ‘/home/avi/Downloads‘ using complete path on either side with cp command.

Now we have passed two arguments with cp command. First is ‘/home/avi/Desktop/1.txt‘ and second is ‘/home/avi/Downloads‘, lets handle them differently, just execute echo [arguments] to print both arguments differently.

Note 1st argument can be printed as “!^” and rest of the arguments can be printed by executing “![Name_of_Command]:[Number_of_argument]” .

In the above example the first command was ‘cp‘ and 2nd argument was needed to print. Hence “!cp:2” , if any command say xyz is run with 5 arguments and you need to get 4th argument, you may use “!xyz:4” , and use it as you like. All the arguments can be accessed by “!*” .

Читайте также:  Gcc для windows stm32

Handle Two or More Arguments

5. Execute last command on the basis of keywords

We can execute the last executed command on the basis of keywords. We can understand it as follows:

Here we have used same command (ls) but with different switches and for different folders. Moreover we have sent to output of each command to ‘/dev/null‘ as we are not going to deal with the output of the command also the console remains clean.

Now Execute last run command on the basis of keywords.

Check the output and you will be astonished that you are running already executed commands just by ls keywords.

Run Commands Based on Keywords

6. The power of !! Operator

You can run/alter your last run command using (!!) . It will call the last run command with alter/tweak in the current command. Lets show you the scenario

Last day I run a one-liner script to get my private IP so I run,

Then suddenly I figured out that I need to redirect the output of the above script to a file ip.txt, so what should I do? Should I retype the whole command again and redirect the output to a file? Well an easy solution is to use UP navigation key and add ‘> ip.txt’ to redirect the output to a file as.

Thanks to the life Savior UP navigation key here. Now consider the below condition, the next time I run below one-liner script.

As soon as I run script, the bash prompt returned an error with the message “bash: ifconfig: command not found” , It was not difficult for me to guess I run this command as user where it should be run as root.

So what’s the solution? It is difficult to login to root and then type the whole command again! Also (UP Navigation Key) in last example didn’t came to rescue here. So? We need to call “!!” without quotes, which will call the last command for that user.

Here su is switch user which is root, -c is to run the specific command as the user and the most important part !! will be replaced by command and last run command will be substituted here. Yeah! You need to provide root password.

The Power of !! Key

I make use of !! mostly in following scenarios,

1. When I run apt-get command as normal user, I usually get an error saying you don’t have permission to execute.

Opps error…don’t worry execute below command to get it successful..

Same way I do for,

OOPS User not authorized to carry such task, so I run..

7. Run a command that affects all the file except ![FILE_NAME]

The ! (Logical NOT) can be used to run the command on all the files/extension except that is behind ‘!’ .

A. Remove all the files from a directory except the one the name of which is 2.txt.

B. Remove all the file type from the folder except the one the extension of which is ‘pdf‘.

8. Check if a directory (say /home/avi/Tecmint)exist or not? Printf if the said directory exist or not.

Here we will use ‘! -d’ to validate if the directory exist or not followed by Logical AND Operator (&&) to print that directory does not exist and Logical OR Operator (||) to print the directory is present.

Logic is, when the output of [ ! -d /home/avi/Tecmint ] is 0, it will execute what lies beyond Logical AND else it will go to Logical OR (||) and execute what lies beyond Logical OR.

9. Check if a directory exist or not? If not exit the command.

Similar to the above condition, but here if the desired directory doesn’t exist it will exit the command.

10. Create a directory (say test) in your home directory if it does not exist.

A general implementation in Scripting Language where if the desired directory does not exist, it will create one.

That’s all for now. If you know or come across any other use of ‘!’ which is worth knowing, you may like to provide us with your suggestion in the feedback. Keep connected!

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Оцените статью