Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common errors and shortcuts in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what common errors and shortcuts in Linux are, concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.

Some unusual cases of commands under Linux

Command incomplete: In the command input is not finished (quotation marks or parentheses are not paired), accidentally press the Enter key, the terminal will prompt a> on behalf of the command is incomplete, this is can continue to enter, you can also ctrl+c to terminate the input, come again. (There is another problem with incomplete commands when the sed command is used below)

ct@ehbio:~/ehbio_project$ rename 'ehbio2>'ct@ehbio:~/ehbio_project$ rename 'ehbio2> ^Cct@ehbio:~/ehbio_project$

File name input error: one more letter, one less letter, capitalization problem

ct@ehbio:~/ehbio_project$lsehbio2.fa ehbio3.fa ehbio4.fa ehbio.fa second.fa#Renaming does not take effect ct@ehbio:~/ehbio_project$ rename 'ehbio2'ehbio5' ebio2.fact@ehbio:~/ehbio_project $lsehbio2.fa ehbio3.fa ehbio4.fa ehbio.fa second.fa#Look carefully, ehbio2.fa is written as ebio2.fa, which can be corrected. Z8vb3e9jtel4m99ss6e7eZ:~/ehbio_project$ rename 'ehbio2' 'ehbio5' ehbio2.fact@ehbio:~/ehbio_project$ lsehbio3.fa ehbio4.fa ehbio5.fa ehbio.fa second.fa

Directory not correct: The file accessed does not exist in the current directory, and no absolute path is provided, or the soft connection is invalid.

ct@ehbio:~/ehbio_project$ lsehbio3.fa ehbio4.fa ehbio5.fa ehbio6.fa ehbio.fa second.fact@ehbio:~/ehbio_project$ ls ../ dataehbio2.fa first.fa#ehbio2.fact@ehbio:~/ehbio_project$ less ehbio2.faehbio2.fa: no file or directory # ehbio2.fa In the data directory of the upper directory ct@ehbio:~/ehbio_project$ ls../ data/ehbio2.fa../ data/ehbio2.fa#add path still cannot access ct@ehbio:~/ehbio_project$ less../ data/ehbio2.fa../ data/ehbio2.fa: No file or directory #The problem above is that the soft link fails, the original ehbio2.fa was deleted in the previous operation, so the shortcut fails #Correct access ct@ehbio:~/ehbio_project$ tail -n 3 ../ data/first.faACGGAGCGAGCTAGTGCAGCGAGGAGCTGAGTCGAGCCAGGACAGGAGCTAend

Linux terminal commonly used shortcut command or file name automatic completion: after entering the first few letters of the command or file name, press the Tab key, the system will automatically complete or prompt completion up and down arrows: use the up and down arrows to go back to the previous command, increase the reuse of the command, reduce the input workload! Add the first few letters of the command you typed earlier and quickly get the command ct@ehbio:~/ehbio_project$ cut -f 1 -d ' ' ehbio.fa| tail -n 4> mYCACGGAGCGAGCTAGGTGCAGCGAGCTGAGTCGAGCCAGAGGAGCTAendct @ehbio:~/ehbio_project$ man cut#Jump directly to the cut command running above and execute ct@ehbio:~/ehbio_project$ ! cutcut -f 1 -d ' ' ehbio.fa | tail -n 4>mYCACGGAGCGAGCTAGTGCAGCGAGGAGCTGAGTCGAGCCAGGACAGGAGCTAend

ctrl+a Return to the beginning of the command line, used to modify the command or comment out the command #Write the following command, suddenly do not want to run, do not want to delete ct@ehbio:~/ehbio_project$ cut -f 1 -d ' ' ehbio.fa| tail -n 4#Press ctrl+a, go back to the beginning of the line, enter `#` again, enter, the command is commented out. ct@ehbio:~/ehbio_project$ #cut -f 1 -d ' ' ehbio.fa | tail -n 4

!! Indicates the previous command. ct@ehbio:~/ehbio_project$ lsehbio3.fa ehbio4.fa ehbio5.fa ehbio6.fa ehbio.fa second.fact@ehbio:~/ehbio_project$ !! lsehbio3.fa ehbio4.fa ehbio5.fa ehbio6.fa ehbio.fa second.fa

Replace the characters in the previous command and run the command again for situations where you need to execute the same command on multiple files without writing a loop #Enter a command ct@ehbio:~/ehbio_project$ #cut -f 1 -d ' ' ehbio.fa| tail -n 4# !! # :gs means replace, replace all ehbio in the previous command with ehbio3; g: global; s: stituect @ehbio:~/ehbio_project$ !!: gs/ehbio/ehbio3#cut -f 1 -d ' ' ehbio3.fa |tail -n 4#After replacement, the effect is as above #Remove the #sign before the command ct@ehbio:~/ehbio_project$ cut -f 1 -d ' ' ehbio3.fa| tail -n 4> mYCACGGAGCGAGCTAGGTGCAGCGAGCTGAGTCGAGCCAGAGGAGCTAend ##Replace ehbio3 with ehbio4, run ct@ehbio:~/ehbio_project$ !!: gs/ehbio3/ehbio4cut -f 1 -d ' ' ehbio4.fa |tail -n 4> mYCACGGAGCTAGCAGCGAGCTGAGTCGCAGAGCCAGAGGAGCTAend What is Linux is a freely available and freely disseminated UNIX-like operating system, a POSIX-based multiuser, multitasking, multithreaded, and multiCPU operating system that runs major Unix tools, applications, and network protocols.

These are the common mistakes and shortcuts in Linux. What are they? Have you learned anything? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report