LQ Poll: What's your favorite Linux terminal trick?
The official LQ poll series continues. This time we want to know: What's your favorite Linux terminal trick?
--jeremy |
I enjoy:
Code:
~$ sl |
Code:
alias path='(IFS=:;ls -1d $PATH | nl)' |
Quote:
On the other hand, now that I've installed it's my new favorite thing :-) I am constantly combining pdfs via terminal: Code:
~$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=<blah> <infile1> <infile2> ... |
I cannot live without the below in my ~root/.bash_profile
Code:
export HISTTIMEFORMAT='%F %T ' |
Adding Line Numbers
Setting up Vim so that line numbers are added when coding, and line numbers are added when printing a hard copy. This is performed as a routine so the number show up anytime a new file is created or an existing file is opened.:)
|
Not using it at all! A+Pete
|
piping and redirection.
|
I know it's very simple, but it took me a while to realise that I could copy and paste text to/from my terminal by using shift-ctrl-c and shift-ctrl-v.
|
In ~/.bash_profile:
Code:
PROMPT_COMMAND="$PROMPT_COMMAND${PROMPT_COMMAND:+;} history -a; history -r" And, naturally, in ~/.bashrc: Code:
source ~/.bash_profile |
Just knowing how to use the command line is about as 'trick' as I get. ;)
But, yeah, piping & redirection gets used quite often, & shell scripting small jobs. |
Inline named pipes <(...), >(...) !
|
I'd say for bash and zsh it would be command substitution $(...) and process substitution < <(...) I use the former a lot but have only occasional opportunity to use the latter.
Edit: here's probably my most unusual use of command substitution. It's from an OpenBSD system which would report the battery status in the shell prompt, but only while the machine was unplugged: Code:
export PS1="\$(if [ 1 -ne \$(/usr/sbin/apm -a) ]; then |
I don't know if this counts, but I have cases where I need to use a lot of [[ ]] shell scripting in cron and I'll be timing resource intensive automated scans to run in absence of a particular PID or file which implies another resource heavy tool - so as not to overburden the servers. The "flock" command has been my friend for sure.
|
Have to install it https://www.linuxquestions.org/quest...ed-4175625577/
Code:
pinxi -v8 |
All times are GMT -5. The time now is 05:07 PM. |