Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
sak9628196yEach one of this I have used but loops will Convert a.PNG a.PNG.jpg so I would say you might want to extract the filename before convert.
And the braces prefer seq command as you can set width like 01, 02, ... 10 .
I would say sed is one of the most powerful tool I have come across -
@Bitwise !! is used to run the last command entirely. If let's say you ran a command but it gave an error that you're not sudo, so you can just do "sudo !!" it will run the entire previous command with sudo.
With "!$" you take only the last word of the previous command. -
vhoyer13536yjust leaving my two cents, ctrl+d ends the session. as far as I can tell, it's the same as running "logout"
but you probably know that -
vhoyer13536y@Bitwise and if you want to get them back to the foreground process just use:
jobs #lists all jobs running
fg x # with x being the id of the process shown by the "jobs" command -
vhoyer13536yalso, there is the
cd -
which expands to
cd /the/last/folder/you/were/in/
this also works with git branches (e.g.: git checkout -) -
My personal favorites: Ctrl+s and Ctrl+q.
As an emacs user with a vim habit, the first one pauses the current process, the second resumes it. -
benrooke846y@Bitwise I believe that if you ctrl-z, and then logout, it’ll kill the process because it was a child process of the current session. I think...
-
sak9628196y@vhoyer
cd - stands for cd $OLD_PWD
@natesymer
I hate that one because I feel like I am saving hence I press it twice then writing something only to realise that it has paused then I press ctrl +q to see that I typed asdfsfssads
Is there any practical use for it ? -
I'd also include `set -o vi` :) For VIM users.
And most of ${variable:XXX} expansions (the XXX parts). Every day they are always behind my belt.
I'm glad noone mentioned backticks... Thanks God these are drowning in the past. It literally (yes, literally) hurts me see scripts written with backticks. -
I like:
$ suod superlongcommand --with-parameters
😡
$ ^suod^sudo.
😄
And I think it pays off to just learn the basics of all the commonly available tools:
pwd, export, cat, less, nc, nl, wc, grep, tee, head/tail, tr, diff/comm/cmp, bc, pass, join, cut, awk, open, find, curl, wget, lsof, expr, which, ln, chmod, chown, uniq, sort... etc
The true power of bash lies in piping & combining commands. A lot of commands to something very simple like manipulating a string or a file.
When you use git, you might think: Oh I wish I could quickly purge all files with that password in it, or rebase all commits up to the point where it forked from master, or you want to remove all "fucks" from your commit messages before pushing -- Pipes |, expansions ${} and substitutions $() can make it easy to chain things together.
And once you have a nice combination commands, don't forget to alias it in your bash (zsh/fish/etc) profile! -
vhoyer13536ythe most important trick I've found so far is:
ALWAYS WRITE --HELP MESSAGES FOR YOUR CUSTOM SCRIPTS
else your gonna find yourself opening that damn file so many times -
bioDan61596yNice! thanks for sharing everyone!
Thanks for sharing your .bashrc scripts @Bitwise 👍
Your code looks good, clean and readable (Given it has a differemt indentation).
Related Rants
Twitter: Julia Evans @b0rk
rant
bash
twitter
unix