Uhhh...sudo su
Don't be like me
Uhhh...sudo su
Don't be like me
clear
because apparently I am too scatterbrained to comprehend more than one full page of text in the terminal
Btop is an amazing resource monitor
Have you tried glances?
I went a little overboard and wrote a one-liner to accurately answer this question
history|cut -d " " -f 5|sort|uniq -c|sort -nr|head -5
Note: history
displays like this for me
20622 2023-02-18 16:41:23 ls
I don't know if that's because I set HISTTIMEFORMAT='%F %T '
in .bashrc, or if it's like that for everyone.
If it's different for you change -f 5
to target the command. Use -f 5-7
to include flags and arguments.
My top 5 (since last install)
2002 ls
1296 cd
455 hx
427 g
316 find
g
is an alias for gitui. When I include flags and arguments most of the top commands are aliases, often shortcuts to a project directory.
Not to ramble, but after doing this I figured I should alias the longest, most-used commands (even aliasing ls
to l
could have saved 2002 keystrokes :P) So I wrote another one-liner to check for available single characters to alias with:
for c in a b c d e f g h i j k l m n o p q r s t u v w x y z; do [[ ! $(command -v $c) ]] && echo $c; done
In .bash_aliases I've added alias b='hx ${HOME}/.bash_aliases'
to quickly edit aliases and alias r='source ${HOME}/.bashrc'
to reload them.
Holy shit, you're a madman
nano
tldr
because I am too impatient to read through man pages or google the exact syntax for what I want to do.
There are exactly three kinds of manpages:
I will take 1 any day over 2 or 3. Sometimes I even need 1, so I'm grateful for them.
But holy goddamn is it awful when I just want to use a command for aguably its most common use case and the flag or option for that is lost in a crowd of 30 other switches or buried under some modal subcommand. grep
helps if you already know the switch, which isn't always.
You could argue commands like this don't have "arguably most common usecases", so manpages should be completely neutral on singling out examples. But I think the existence of tl;dr is the counterargument.
Tangent complaint: I thought the Unix philosophy was "do one thing, and do it well"? Why then do so many of these shell commands have a billion options? Mostly /s but sometimes it's flustering.
Sudo !!
It reruns the last command as sudo.
Pretty useful since I'm always forgetting.
Most commands soon followed by sudo !!
ncdu
qmv -f do ${dir}
... for quickly moving and renaming files. The default 'qmv' opens up your preferred text editor with a list of the source and destination name of the directory of files you want to move/rename. The '-f do' tells the command we only want to see/edit the [d]estination [o]nly. If you need to rename/move a bunch of files, it's much quicker to do it in vim (at least for me).
It sounds similar to one of my favorite commands! vidir ๐
du -sh /too/bar
to get size of files/folders. sudo !!
inserts sudo into previous command when forgotten. yay
for full system update if yay is installed. cat
reads files.
cd
every single day.
You haven't discovered exa
? Noob
/s
Seems like an appropriate place to share https://github.com/agarrharr/awesome-cli-apps
I'm a fan of ripgrep and lsd in particular.
Big fan of lsd too.
But on a blotter
control+R
in bash, it lets you quickly search for previously executed commands.
its very useful and makes things much quicker, i recommend you give it a try.
Not a command but bang expansions. For example !?
is the args of last command useful for stuff like mkdir foo ; cd !?
https://www.redhat.com/sysadmin/bash-bang-commands learn these. you suck at using your computer if you don't know them.
Is there something similar in fish shell?
sl
sudo !!
to rerun last command as sudo.
history
can be paired with !5
to run the fifth command listed in history.
CTR + u will delete the whole command. I use that a lot so I don't have to backspace. It's saved me a ton of time
This is great for when you type in your root password incorrectly!
How about ctrl+c to cancel and clear the command you are typing? It's much easier because you only need 1 hand, and does not impact your shell's history.
Related: Alt + .
, to cycle through arguments used in previous commands
pv (Pipe Viewer) is a command line tool to view verbose information about data streamed/piped through it. The data can be of any source like files, block devices, network streams etc. It shows the amount of data passed through, time running, progress bar, percentage and the estimated completion time.
ls
ls -ltrc
Show most recently modified files.
A loosely moderated place to ask open-ended questions
Search asklemmy ๐
If your post meets the following criteria, it's welcome here!
Looking for support?
Looking for a community?
~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~