Your top 10 commands - Desktop Customization & Workflow
Users browsing this thread: 1 Guest(s)
|
|||
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. |
|||