LQ Poll: What's your favorite Linux terminal trick?
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
$ cat /etc/profile.d/local.sh
alias dir="ls -al"
alias ll="ls --color=auto -alio --time-style=+'%Y-%m-%d %H:%M:%S'"
alias l="ls --color=auto -aCF"
alias a=alias
alias et="exec tcsh"
Now, the first command I give when loging in to a user that does not have the correct shell is
I have run into some older, particularly proprietary/industrial type OSes/control systems where there is no more/less/any command to control output flow and this has been useful. Also people who have worked out of terminals for a long time suddenly remember "the good old days" when you do it, heh.
I download lots of MP4 & MKV video files and sometimes they are subtitled so these are the command-lines to zap 'em.
For mkv: mkvmerge --no-subtitles input.mkv -o output.mkv
For mp4: mencoder input.mp4 -ovc copy -oac copy -o output.mp4
Apart from some readline keybindings such as C-a, C-k, C-e, C-u, C-y, M-y, C-w etc. that really not many people use in practice I like dabbrev-expand feature of xterm:
Quote:
dabbrev-expand()
Expands the word before cursor by searching in the preceding
text on the screen and in the scrollback buffer for words
starting with that abbreviation. By default bound to Meta /.
Repeating dabbrev-expand() several times in sequence searches
for an alternative expansion by looking farther back. Lack of
more matches is signaled by a beep(). Attempts to expand an
empty word (i.e., when cursor is preceded by a space) yield
successively all previous words. Consecutive identical expan-
sions are ignored. The word here is defined as a sequence of
non-whitespace characters. This feature partially emulates the
behavior of `dynamic abbreviation' expansion in Emacs (also
bound there to M-/).
I have this in my ~/.Xresources:
Code:
UXTerm*VT100.Translations: #override \n\
Meta <Key>/:dabbrev-expand() \n\
I use it daily, for example after running
Code:
udisks --mount /dev/sdc1
something like that this is shown:
Code:
Mounted /org/freedesktop/UDisks/devices/sdc1 at /media/757f2f53-f46a-4a28-90a7-f36ae106071b_
Now to go to /media/757f2f53-f46a-4a28-90a7-f36ae106071b_ I just type /m and pres M-/ (Alt-/) and the entire '/media/757f2f53-f46a-4a28-90a7-f36ae106071b_' string shows up on the screen. There is no way to do that with pure Bash AFAIK but I heard it might be possible to achieve with ZSH.
Apart from that I enjoy using GNU screen thanks to it copying && pasting and screen recording capabilities.
Scenario... son leaves a couple of hundred tabs open, I want to go to sleep and in the morning I want to briefly use my computer without battling 100's of tabs for a CPU slice.
Answer: Switch to "The Dark Place" , a virtual console (ctrl-alt-f1), log in as root...
It borrows a trick from systemd... if you kill a child process the parent may attempt to restart it. But if want them all dead anyway.... stop them all (including the parent), then kill them.
Let the fallout of that settle for a second, then invoke power management suspend which puts the whole desktop to sleep... all the blinkenligte go off.
If anyone wakes it by touching a button, it logs out of root.
As a relative new user again(been over 25 years so since HP-UX and SuSe 3.5) just being able to use terminal commands at all without a lot of head scratching
!some_command to re-run a command from history. Can be shortened to the a unique sub-sed of the name. e.g. !so
Ctrl-d to exit from su -- or the terminal if it's the last login
Ctrl-l to clear the screen (learned that one recently here) -- that's an ell, not a one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.