All Questions
10 questions
1
vote
2
answers
167
views
like history and fc but for a personalized list of useful commands
I have spent a few hours trying to get an easy access to my most useful commands I have to use in a certain environment, I have the "incredible" idea of using history for that purpose, to ...
1
vote
2
answers
239
views
bash, pass an argument to the 'history' command
I do the following to make history more sensible (i.e. seeing when a command is run can be fairly critical when troubleshooting)
shopt -s histappend; # Append commands to the bash history (~/....
2
votes
2
answers
532
views
Short command or alias to copy last command to clipboard
Often I'd like the command I just typed to put into the clipboard, and I'd like to do it from the command line.
I came up with:
alias cl="fc -ln -1 | sed 's/^\s*//' | xsel -b"
To alias cl to that ...
1
vote
1
answer
325
views
How to set an alias upon command execution?
I want other developers to have some convenient methods. Therefore I want to give them a script, that automatically sets an alias.
E.g the command grunt compileModule:[modulename] should set the ...
1
vote
2
answers
123
views
Can I alias `!<editor>` in bashrc? [duplicate]
I use emacs as an editor in the command line (aliased with alias em='emacs -nw') and would like to be able to make an alias for !em to open up the file most recently opened in emacs.
I've tried alias ...
0
votes
1
answer
3k
views
How does this bash alias to repeat the last command as sudo work? [duplicate]
I recently came across this ingenious bash alias to repeat the last issued command, but as sudo.
This could be done by using sudo !! directly in the terminal after the failed command.
The alias I ...
1
vote
2
answers
799
views
alias for a command using !! to recall the last command [duplicate]
This is a follow-up question to
Execute a line of commands with one sudo
If you want to redo the same command with sudo !! after doing a command like this:
echo "something">/path/file
You can ...
8
votes
2
answers
1k
views
Why does !! inside an alias not work?
I have this alias set in my system /etc/bashrc file:
alias root="sudo !!"
The intention of this being to run the last used command using sudo of course. When used, it of course appears to substitute ...
63
votes
6
answers
48k
views
How can I `alias sudo !!`?
I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints
sudo: !!: command not found
If I use double quotes, it substitutes the ...
12
votes
1
answer
6k
views
How can I alias to `!!` (last command)? [duplicate]
!! in bash runs last command. I find it too difficult to type given how much I use it. alias to the rescue, I presumed.
Or not. I tried:
$ alias dl='!!' # Aliasing
$ echo Testing123 ...