Linked Questions
21 questions linked to/from What are your favorite command line features or tricks?
149
votes
5
answers
199k
views
Understanding the exclamation mark (!) in bash
I used
history | less
to get the lines of previous commands and from the numbers on the left hand side I found the line I wanted repeated (eg. 22) and did
!22
at the command prompt and it worked -...
96
votes
15
answers
97k
views
Best way to search through shell's history
Is there a better way to search my history file for a command than grep? I do have some idea what the command starts as, but I don't know how far back in the history it is.
update: was formerly zsh ...
69
votes
6
answers
45k
views
How to echo a bang!
I tried to create a script by echo'ing the contents into a file, instead of opening it with a editor
echo -e "#!/bin/bash \n /usr/bin/command args" > .scripts/command
The output:
bash: !/bin/...
30
votes
5
answers
6k
views
Use same arguments with different command [duplicate]
Here's something I find myself doing often:
less super/long/file/name
Followed by:
vim super/long/file/name
Is there an easy way to pass the args of the previous command over to the next? SO I'd ...
24
votes
15
answers
7k
views
What customizations have you done on your shell profile to increase productivity?
I know some people have some startup scripts and some people personalise the prompt. One developer uses short aliases for the long path he often visits and the frequent commands he runs.
What are all ...
20
votes
3
answers
1k
views
Where can I find documentation about the "sudo !!" command
I just learned that Linux has a sudo !! command which literally applies sudo to the last entered command. I had never heard about it.
Is that a common control? Where can I find documentation about ...
29
votes
2
answers
3k
views
What does !#:3 mean in a shell command
The install guide for ack suggests installing the ack script using this command:
curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3
I assume that the !#:3 at ...
22
votes
2
answers
4k
views
What does the combination ^foo^bar do in Bash? [duplicate]
I recently saw a video where someone executed ^foo^bar in Bash. What is that combination for?
12
votes
8
answers
627
views
How to access the history on the fly in Unix?
For example, if I do a
mkdir thisismyfolder912
I remember there is some easier way to switch to thisismyfolder912 than having to do a
cd thisismyfolder912
What is that way and how does it work? ...
12
votes
7
answers
5k
views
Which run dialog
I just switched from the standard Gnome window manager to Openbox (still running inside Gnome) and like it a lot. However, now I need a new run dialog, e.g. the thing popping up when hitting Alt+F2 in ...
14
votes
2
answers
5k
views
grep - why do brackets in grep pattern remove the grep process from ps results?
Why do brackets in a grep pattern remove the grep process from ps results?
$ ps -ef | grep XXXX
[...] XXXX
[...] grep XXXX
$ ps -ef | grep [X]XXX
[...] XXXX
3
votes
2
answers
11k
views
Frequently used "ps" (process status) commands in linux? [closed]
EDITED:
These are the the only most commonly used (and important) ps command options I've come across so far: $ ps ux, $ ps au, $ ps aux, $ ps U aahan, $ ps uU aahan
So, is that all, or am I missing ...
6
votes
1
answer
10k
views
shell command cd !$ [duplicate]
I looked at this question and googled, but can't find a definitive answer. What does !$ do when typed into terminal?
I typed
mkdir /path/to/dir
cd !$
Which brought me to /path/to/dir but I still ...
7
votes
3
answers
2k
views
Execute a file in an application based on the file's extension in bash
After reading this answer about a zsh feature:
If a given extension has a suffix
alias, you can execute a file with
that extention directly, and ZSH will
launch the given program and pass the
...
4
votes
2
answers
9k
views
How to view commandline of processes executed in last 10 seconds
Is there a view to log and list down the processes executed in last 10 seconds ?
I especially want to trace the command line.