Swap last two words in Bash
Answer:
Previous article we mentioned how to swap the last two characters in Bash, now we let you know how to Swap the last two words in Bash
Solution:
# foo bar
[Esc + t]
That's simple, isn't?
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Swap last two words in Bash
Answer:
Previous article we mentioned how to swap the last two characters in Bash, now we let you know how to Swap the last two words in Bash
Solution:
# foo bar
[Esc + t]
That's simple, isn't?
Remove the whole line when typing a command in Bash
Answer:
When you are typing a command in Bash shell, , to quickly remove the whole line, press "Ctrl + u" or "Ctrl + c"
This trick is very handy and should be known by all Bash users.
You might also want to read:
Remove the last word when typing a command in Bash
Answer:
When you are typing a command in Bash shell, , to quickly remove the last typed word, press "Ctrl + w"
This trick is very handy and should be known by all Bash users.
Swap last two characters in Bash
Answer:
Sometimes it is easy to mis-type characters in the wrong order, e.g. typed "sl" instead of "ls"
To swap it, use the little know Bash's trick: Ctrl + t
E.g.
# sl
[Ctrl + t]
How to echo a tab in bash?
Answer:
In Bash script, if you want to print out unprintable characters such as tab, you need to use -e flag together with the echo command.
E.g.
echo -e "\tfoo\tbar"