NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Stupid Bash Tricks: Magic Carets Correct Munged Commands
Topic: GNU/Linux   Posted:2002-12-30
Printer Friendly: Print

spacerspacer
We all have fat fingers sometimes and mistype commands, often transposing letters in a word or leaving letters out. When using Bash, you can fix it with the magic carets instead of retyping the whole command.
example:

[root@pippi opt]# usradd -u 666 -g 100 udergahad
bash: usradd: command not found

Oops, it should be "useradd". OK, we'll use the magic carets to fix.

[root@pippi opt]# ^ra^era^
useradd -u 666 -g 100 udergahad
[root@pippi opt]# 

By replacing the string "ra" with the string "era", we correct our spelling and the command runs as intended. The substitution will act on the first instance of the string. This one is pretty cool when people are hovering around looking over your shoulder, especially if you do it quickly.





Please read our Terms of Use and our Privacy Policy
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2009 NetAdminTools.com

Created by:
MCJ
MCJ CMS