Your top 10 commands - Desktop Customization & Workflow
Users browsing this thread:
|
|||
After reading this post on z3bra's phlog, I got curious to see what are my top 10 commands.
Quote:Now what are YOUR top 10 commands ? On OpenBSD ksh, the history builtin only lists the last 10 commands on history, to list all commands, you need to run this: Code: history 1 So, this is the command I needed to run: Code: history 1 | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 10 My $HISTSIZE is 1000, so my sample is not that big as z3bra's (whose $HISTORY is ten times bigger). Here's my top 10:
|
|||
|
|||
Holy cow that post was 1 year ago already ! Good retrospective, given that your top command is vim, I'd suggest aliasing it 😉
That's funny to see you use tree rather than ls. isn't it too verbose when you got a lot of subdirectories ? do you pipe it to less then ? |
|||
|
|||
I’ve read z3bra’s phlog post a couple of weeks ago but thanks for opening this thread!
So, here’s my top 10:
|
|||
|
|||
I wrote a follow up log to z3bra, my top ten are:
Code: $ history | awk '{print $4}' | sort | uniq -c | sort -rn | head -n 10 |
|||
|
|||
Top Ten:
sudo breakdown: * apt-get - installing/updating/cleaning up packages * vim - editing system files * mount - mucking around with university cifs shares * systemctl - stuck with systemd for now, for fear I'd break commercial software * mkdir - reorganizing installed scripts / libs * chown - cleaning up permissions * mv - reorganizing * chmod - cleaning up permissions * ufw - opening ports * virsh - starting/configuring vm's Here's a hack for the last bit: Code: history|grep "^[^ ]*[ ]\bsudo\b"|awk '{print $3}'|sort|uniq -c|sort -rn|head -n 10 |
|||
|
|||
(15-10-2021, 02:26 AM)z3bra Wrote: That's funny to see you use tree rather than ls. isn't it too verbose when you got a lot of subdirectories ? do you pipe it to less then ? The function I wrote defaults to depth 1 (no subdirectories), but I can call it with the option -2 to list contents of subdirectories, -3 to list content of subdirectories up to depth 3, etc. Or -0 to recursively list at infinite depth. So there's no need to pipe to less, since the default output is not recursive. The function also has find(1) functionalities. If I give it an argument, it looks for a file named as the argument in the filesystem up to the depth I specify. The function also lists in the long format, so I get the size of the files and their permissions. ls -Rl and find -iname in a single command! |
|||
|
|||
Code: % history 1 | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 10 But that's very likely wrong, because I use lot of terminals, and histories does not merge well. I'm not surprised with the high top though, git being such a pain in the ass to use, you have to use it a lot before commiting something. ls and cd... well, I should alias them to something which does both, or even better, stop using shell directly, because shells are so not convenient to use interactively... that's still the kind of stuff I summon a lot, though. Then goes vim and make, not surprising as coding is one of my major occupations. I'm surprised to see rm that high, before grep and find, I would have thought I use those more often... and then yes, I read lot of man pages, which includes almost each time I need a `test` or a decent `find`. As for ps, yeah, I'm constantly hunting stuff which wastes my computer's resources. I'm a bit surprised to not see pstree or pree in there, though. |
|||
|
|||
Code: 16223 cd Sample size is 88k, mix - alsamixer, loc - online+vpn checker cd is killing me, I need to install zsh and do a/b/c and adopt jump program. |
|||
|
|||
My $HISTSIZE is 100k so the sample is quite big.
Here's the unsurprising result I get: Code: 4685 vim |
|||
|
|||
Why the hell do you guys use rm(1) so much ?
|
|||
|
|||
For me, the 2 main reasons I can see are:
1) removal of screenshots, that I should likely just put in /tmp instead (yeah, I *should* do that, and other adjustments, too) 2) removal of garbage programs leave behind, even in /tmp (yeah, I *should* find a way to remove /tmp stuff after some some duration...) 3) removal of cmake's or other toolis like this artifacts when stuff break 4) removal of temp files I write, often in my $HOME Other than that... I don't know, it surprises me too. Globally, I think my workflow is pretty inefficient, tbh. |
|||
|
|||
I rm: directories, temp files, scripts, configs, movies I just watched, archives after extraction etc.
Mostly just files, all sorts of files. It's probably depends on workflow, if it's git-centric or not. |
|||
|
|||
You guys should mount your download directory as TMPFS 😉
This way everything I download goes to ~/tmp and is wiped as I reboot. So when I download archives, I extract them right in ~/tmp, and only move files I need in there, leaving the archive in ~/tmp knowing it'll disappear on next reboot. |
|||
|
|||
My downloads folder is more of a 'to sort' folder, I know most of things just decaying in there, but I will get to it one day.
|
|||
|
|||
I prefer not to keep a static history file, as I may type sensitive information on the terminal; instead, I like to have per-session history:
Code: if [ -d ~/.history ]; then |
|||
|
|||
|
|||
(01-03-2022, 06:04 AM)venam Wrote: What's your process to search in the history file? I use a function like: Code: # show history Quote:Do you purge old files also? Well, if you look at the HISTFILE settings I posted above, each login shell has its temporary history, which is purged upon exiting. As I have rxvt set to spawn a login shell by default, each terminal emulator under X has its own temporary history. Quote:For many the histfile is a huge source of knowledge, so they increase it's size as much as possible (including me). I won't deny understanding this perfectly ;). Personally however, I've become accustomed to save useful commands in functions, aliases or ~/.bin scripts. Not having a history to rely on forces me to actually look carefully at the commands I find online (e.g., the typical 'awk' magic one may find it hard to figure themselves), so as to remember them the next time. |
|||
|
|||
Just in case anyone wonders, this command works on macOS (with the tcsh):
Code: % history | awk '{print substr($0,index($0,$3))}' | sort | uniq -c | sort -rn | head -n 10 (I won't post my results here - there are personal data in them.) -- <mort> choosing a terrible license just to be spiteful towards others is possibly the most tux0r thing I've ever seen |
|||
|
|||
I use a lot of programs from Plan9port, including rc as my shell. rc has no history file support.
Instead of relying on my shell to create my history, I use my text editor, acme. Acme has this neat feature where you can spawn a shell within an acme window, which means that it's essentially a terminal inside of a plaintext file. At any point it can be edited or saved. So that instead of having a history file, I have a history directory. Whenever I do something somewhat complex or I figure out the perfect awk script to preform some function, I save all the relevant commands with their output to a file in my history directory. For example, I have a file for generating new git repos for stagit on my server. I find it a much better reference than a simple history file, because not only do I get the command(s) that worked, I also get why they worked, and why another command didn't. I can even add notes while I'm executing the commands, or after I save the file. It gives me a better understanding of my command history. I also don't have to sift through a million 'cd' or 'ls' commands. If I had a proper history file, my top ten would probably be some combination of p (alias for plumb), ls, cd, git, man, rm, B, mv, Sel (used for looking through my music library in acme), and ssh. |
|||
|
|||
1. vim
2. cd 3 ls (cd and ls being high up makes sense, I don't use a file manager) 4 sudo (presumably from using pacman) 5 make 6 neocities (for pushing to my blog, surprised it's this high up) 7 rm (guess i make a lot of mistakes lol) 8 n (alias for newsboat) 9 iamb (matrix client) 10 ssh (hanging out on pubnixes) |
|||
|
|||
I think I got polluted by my own ecosystem and do not have a sane workflow like Yuno but....
I rarely do "ls": I use tab to show the list of files, and disable bash specific completion (so that it shows the files even when it expects only directories). I rarely do "cd": I run most things from some project directory, and I have "cd ~/zephyrproject/zephyr" in ~/.bashrc for whichever project I work on. 1. "xrun" - (which I bound to a keybinding: a script to open a new https://tools.suckless.org/tabbed/ terminal, with an initial command that spawn at every new tab, or if a tabbed window is focused, spawn the command as a tab *inside* the focused window) 2. "$clientname" - (which is an alias to something like "xrun sudo -s -u $clientname" to run a new session in /home/$clientname where every time I spawn a new tab, it's under that user. 3. "root" - alias to "xrun sudo -s" which I call from dmenu to run a temporary terminal tab as root within some other "tabbed" session (i.e. modify /etc/profile where all these aliases are) 4. "o" - open the file on a new local tab, even if it is over SSH: alias to xopen (my xdg-open script with a giant "case $1 in (https://...) ... ;; esac"... or if running from ssh, send "ssh://$HOST/$filename" to "/tmp/$user@host.sock" which is telling my local host to call xdg-open on that, which recognizes "ssh://" and spawns "xrun ssh $HOST $EDITOR $filename" 5. "xssh" - same as ssh, but setups the socket forwarding like used above. Some ad-hoc unixargs.c combines unix socket and xargs, to spawn the xdg-open on every `\n` lines received from the "o" alias (source below) 6. "west" - the command to compile and run unit tests on Zephyr 7. "make" - various projects which uses it 8. "www" - at least once per day to start the big bad browser 9. "irc" - ssh to $HOST and calls "abduco -a irssi" to check out messages 10. "rm -rf" - muahahahahahahaha (delete ./out-twister/ directory or ./build/ that keep spawning on builds) Code: #include <stdio.h> P.S.: I know I can use tmux to skip all of that messy business, but I'm trapped in my own habits, please come save me! (;_;) :P |
|||
|
|||
I think I under-estimated the git commands in that. Glad to be reminded to actually check the data:
Code: git --all --decorate --oneline --graph # aliased to git dog Very glad to learn about https://github.com/ulyssa/iamb ! |
|||