Your top 10 commands - Desktop Customization & Workflow

Users browsing this thread: 1 Guest(s)
seninha
Long time nixers
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 ?
-- z3bra

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
(history arguments are [first [last]]).

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:
  • 1. vim: I expected that.
  • 2. make: I use makefiles to build programs and documents, move my dotfiles to their proper places, etc.
  • 3. cd
  • 4. d: This is a shell function wrapper around tree(1) (actually colortree(1), a colored version of tree). Yes, I use tree(1), and not ls(1), to list the contents of a directory...
  • 5. agenda: That's a shell script that shows a calendar for the current month, the events for the week and the tasks I need to do. Very handy. For events it calls calendar(1), for the tasks it calls todo(1). Both programs are part of my orgutils. This script reads the agenda and todo files in all directories of '~/proj/' (that is, in every project of mine), adds a prefix to each event and task corresponding to the project name, and pipes them to agenda(1) and todo(1).
  • 6. git.
  • 7. man.
  • 8. xopen: That's my opener script. If I want to open a image with sxiv or a document with zathura, I just call xopen on them.
  • 9. ssh.
  • 10. fm: That's actually an alias for lf, the file manager, with some options.
z3bra
Grey Hair Nixers
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 ?
tuxifreund
Members
I’ve read z3bra’s phlog post a couple of weeks ago but thanks for opening this thread!

So, here’s my top 10:
  • 1. git - I didn’t expected to see git before vim, but I really use git often and as my vim is opened longer and I just open a new buffer there.
  • 2. vim - Place 2 is well, too.
  • 3. sudo - mostly used to run pacman as root to install packages
  • 4. l - alias of
    Code:
    ls
    , which itself is an alias of
    Code:
    ls --color=auto
  • 5. mutt - Do I really use mutt that much?
  • 6. tmux - Didn’t thaught seeing this on place 6.
  • 7. python − Most of my programs are written in python, so this is the command I start them.
  • 8. toot - my Mastodon client
  • 9. ssh - I use this to administrate my server and to ssh to it as there is running my WeeChat instance
  • 10. rm - Nothing to say here.
ols
Members
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
   10442 vim
   8521 k
   5755 git
   5644 cd
   5091 ls
   4155 ssh
   3560 cat
   2251 curl
   1406 make
   1385 pscli
dionys
Nixers
Top Ten:
  1. sudo - nearly a third of the history
  2. vim - main editor, also used to view files when I want highlighting or folding
  3. apt-cache - searches for packages, or checking dependencies
  4. ls - alias that adds '--color=auto'
  5. lp - lots of print jobs with custom parameters
  6. cd - lots of these from going up or down one level
  7. git - breakdown: log, status, pull, clone, config, remote, init, describe
  8. echo - testing regex makes this pretty high
  9. cat - viewing file contents
  10. mv - wrangling third-party code in /opt/ that I rebuild when there's an update

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
seninha
Long time nixers
(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!
freem
Nixers
Code:
% history 1 | awk '{print $2}' | sort | uniq -c | sort -rn | head -n 10
   1407 git
    662 ls
    530 cd
    340 vim
    279 make
    144 rm
    131 grep
    107 find
     82 man
     72 ps

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.
humky
Members
Code:
16223 cd
10417 vim
6059 cat
4991 ls
3866 mix
3631 touch
2712 rm
2135 sudo
1782 mv
1650 loc

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.
venam
Administrators
My $HISTSIZE is 100k so the sample is quite big.
Here's the unsurprising result I get:

Code:
4685 vim
   3931 cd
   2969 mv
   2868 rm
   2342 sudo
   1948 mplayer
   1651 git
   1332 man
   1036 cp
   1003 cat
z3bra
Grey Hair Nixers
Why the hell do you guys use rm(1) so much ?
freem
Nixers
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.
humky
Members
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.
z3bra
Grey Hair Nixers
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.
humky
Members
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.
VMS
Members
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
      HISTFILE=~/.history/hist.$(tty | sed 's;.*/;;')
          trap 'rm -f $HISTFILE' EXIT
    else
      HISTFILE=~/.history
    fi
venam
Administrators
(28-02-2022, 11:48 AM)DECnet Wrote: I like to have per-session history
What's your process to search in the history file? Do you purge old files also?

For many the histfile is a huge source of knowledge, so they increase it's size as much as possible (including me).
VMS
Members
(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
        h() {
                fc -l 1 | sort | uniq;
        }

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.
jkl
Long time nixers
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
Hatbox
Registered
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.