LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-16-2019, 08:28 AM   #1
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 12,992

Rep: Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706Reputation: 3706
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
 
Old 05-16-2019, 08:35 AM   #2
greencedar
Member
 
Registered: Sep 2018
Location: Missouri / Taiwan
Distribution: Ubuntu 18.04 Bionic Beaver & Linux Mint 19.1 Tessa
Posts: 476
Blog Entries: 1

Rep: Reputation: 28
I enjoy:

Code:
~$ sl
 
4 members found this post helpful.
Old 05-16-2019, 09:55 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,450

Rep: Reputation: 210Reputation: 210Reputation: 210
Code:
alias path='(IFS=:;ls -1d $PATH |  nl)'


0:% path
ls: cannot access '/home/billy/R/usr/bin': No such file or directory
ls: cannot access '/home/billy/R/bin': No such file or directory
     1  /bin
     2  /home/billy/bin
     3  /home/billy/go
     4  /home/billy/usr/bin
     5  /sbin
     6  /usr/bin
     7  /usr/games
     8  /usr/local/bin
     9  /usr/local/games
    10  /usr/sbin
 
2 members found this post helpful.
Old 05-16-2019, 09:58 AM   #4
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 177
Blog Entries: 2

Rep: Reputation: 32
Quote:
Originally Posted by greencedar View Post
I enjoy:

Code:
~$ sl
Didn't know what you are talking about - not installed by default on my system (Xubuntu something something). Does that count as a "trick"? Because if anything you can install counts as a trick...

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> ...
but also doubt that's a trick. I mean, is tab-complete a trick? If so, that's my favorite because I could not live without it.
 
1 members found this post helpful.
Old 05-16-2019, 10:18 AM   #5
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 468

Rep: Reputation: 89
I cannot live without the below in my ~root/.bash_profile
Code:
export HISTTIMEFORMAT='%F %T  '
export HISTSIZE=1000000
export HISTCONTROL=ignoreboth
 
2 members found this post helpful.
Old 05-16-2019, 10:33 AM   #6
Jack_Fedora
LQ Newbie
 
Registered: Aug 2007
Posts: 25

Rep: Reputation: 0
Smile 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.
 
Old 05-16-2019, 10:47 AM   #7
miquelets46
LQ Newbie
 
Registered: Jun 2006
Location: France
Distribution: Linux Mint
Posts: 2

Rep: Reputation: 0
Not using it at all! A+Pete
 
Old 05-16-2019, 11:09 AM   #8
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: Currently OpenMandriva. Previously openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 2,912

Rep: Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508Reputation: 1508
piping and redirection.
 
1 members found this post helpful.
Old 05-16-2019, 11:23 AM   #9
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,016
Blog Entries: 5

Rep: Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859Reputation: 2859
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.
 
13 members found this post helpful.
Old 05-16-2019, 11:58 AM   #10
wjaguar
LQ Newbie
 
Registered: Oct 2007
Distribution: Slackware
Posts: 13

Rep: Reputation: 11
In ~/.bash_profile:
Code:
PROMPT_COMMAND="$PROMPT_COMMAND${PROMPT_COMMAND:+;} history -a; history -r"
Keeping consistent history when running several shells at once.

And, naturally, in ~/.bashrc:
Code:
source ~/.bash_profile
Having shells init the same regardless of the way they are started.
 
1 members found this post helpful.
Old 05-16-2019, 12:16 PM   #11
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,076

Rep: Reputation: Disabled
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.
 
Old 05-16-2019, 12:17 PM   #12
DGPickett
LQ Newbie
 
Registered: Jan 2012
Posts: 13

Rep: Reputation: Disabled
Inline named pipes <(...), >(...) !
 
Old 05-16-2019, 12:39 PM   #13
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,063
Blog Entries: 3

Rep: Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960
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
   echo \"\$(/usr/sbin/apm -l)% \W \\$ \";

elif [ 3 -eq \$(/usr/sbin/apm -b) ]; then
   echo \"+\$(/usr/sbin/apm -l)% \W \\$ \";

else
   echo '\W \\$ '

fi)"

Last edited by Turbocapitalist; 05-18-2019 at 03:17 AM.
 
2 members found this post helpful.
Old 05-16-2019, 12:52 PM   #14
RickDeckard
Member
 
Registered: Jan 2014
Location: Acworth, Georgia, USA
Distribution: Arch Hardened, Ubuntu 18.04, Fedora 30
Posts: 160

Rep: Reputation: Disabled
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.
 
Old 05-16-2019, 01:23 PM   #15
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 17
Posts: 5,817
Blog Entries: 21

Rep: Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887Reputation: 2887
Have to install it https://www.linuxquestions.org/quest...ed-4175625577/


Code:
pinxi -v8
trips my trigger when trying to get system info from a new user.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: What is your favorite Linux terminal trick? LXer Syndicated Linux News 0 08-01-2018 12:41 PM
Poll: (Without the poll) - How is Linux used in your workplace? SlowCoder General 13 09-11-2007 11:03 PM
vim :gui trick and undo-trick dazdaz Linux - Software 3 09-10-2007 02:45 PM
Poll: What is your favorite brand of Motherboard? dstrbd1 Linux - Hardware 2 02-16-2006 05:40 PM
Weekly Hardware Poll, Dec 14th: What's your favorite notebook? finegan Linux - Hardware 18 12-03-2004 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration