LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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: 13,597

Rep: Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080Reputation: 4080
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
Senior Member
 
Registered: Sep 2018
Distribution: Linux Mint 19.1 Tessa & 19.3 Tricia
Posts: 1,314
Blog Entries: 1

Rep: Reputation: 128Reputation: 128
I enjoy:

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

Rep: Reputation: 239Reputation: 239Reputation: 239
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
 
3 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: 297
Blog Entries: 2

Rep: Reputation: 37
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.
 
2 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: 525

Rep: Reputation: 95
I cannot live without the below in my ~root/.bash_profile
Code:
export HISTTIMEFORMAT='%F %T  '
export HISTSIZE=1000000
export HISTCONTROL=ignoreboth
 
5 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: 3

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, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

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

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

Rep: Reputation: 24
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.
 
6 members found this post helpful.
Old 05-16-2019, 12:16 PM   #11
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan with some Tiny Core, Fatdog, Haiku, & BSD thrown in.
Posts: 5,427

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: 17

Rep: Reputation: Disabled
Inline named pipes <(...), >(...) !
 
1 members found this post helpful.
Old 05-16-2019, 12:39 PM   #13
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,236
Blog Entries: 3

Rep: Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710Reputation: 3710
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: Canton, Georgia, USA
Distribution: Debian 12
Posts: 205

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 23, MX 23
Posts: 7,048
Blog Entries: 21

Rep: Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470Reputation: 3470
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 09:03 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
Open Source Consulting | Domain Registration