As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label command-line. Show all posts

ASCII-Pony is a screenshot information tool, but it does not display distribution logo like screenFetch, ponies from My Little Pony: Friendship Is Magic (2010-) instead, which is an animated television show for children.

https://lh3.googleusercontent.com/-4firlCDbHHk/VohyIxUeyII/AAAAAAAAIyM/l6fTI8UqOXQ/s800-Ic42/ASCII-Pony.gif

The script is even named systempony, how fitting to this pony overloading tool. You pony it for screenshot, pretty sure its a verb. As for what it actually mean, I have no clues.

dus is meant to have better output than GNU du -s, which simply summarized the current directorys size (recursively), and bar chart for visualization of sizes.

https://lh3.googleusercontent.com/-fGK67jXeexo/VnSkafYPtXI/AAAAAAAAIpY/4ECerkOqR-8/s800-Ic42/2015-12-19--08%25253A19%25253A28.png

Watch this video for more usages

It has quite a few of options to use, watch this video for examples of some of them:

-0 Use null character (0) as target separator for stdin.
-c <count> Number of items to printout of result head.
--color Colorized output for easier interpretation.
-d Dont enter directory. Only used if a single directory is defined as target.
-h Print human readable sizes (e.g., 1K 234M 5G).
-i Inverted/reverted order of listed result.
-n Enable natural sort order if sort order is a string representation.
-s <...> Sort by property; size, name, atime, mtime, ctime.
-t <ms> File/directory parse timeout given in milliseconds.

You can also pipe in list of directories or files to dus, it reads from standard input as well and gives you the output you want.

dus was created by Rikard Johansson on 2015-10-16, written in C++14 under GPLv3, currently v0.0.6 (2015-12-18).

I use command-line a lot and sometimes a command takes time to execute. So, months ago, I started to use the following alias:
alias beeps='for i in {1..5}; do aplay -q /usr/share/sounds/generic.wav; sleep 0.5s; done'
I ran it like:
command ; beeps
I just left the command to run and came back when I heard the beeping sound. That alias was just ugly simple and did what I need: getting notified when the job is done. It's very help for running commands don't have notifications, which most command-line program wouldn't have. I just append the beeps after the commands, such as eix-sync, emerge, etc.

I updated the alias, so it would play different sounds depending on the exit status, also it retains the exit status after it plays the sound. Although, I don't think retain of exit status is really necessary, nonetheless it's not hard to implement and nice to have.
alias beeps='(BEEPS_RET=$? ; ((BEEPS_RET)) && BEEPS=error || BEEPS=generic ; for i in {1..5} ; do (aplay -q /usr/share/sounds/$BEEPS.wav &) >/dev/null ; sleep 1 ; done ; exit $BEEPS_RET)'
With pretty-print:
(
  BEEPS_RET=$?
  ((BEEPS_RET)) && BEEPS=error || BEEPS=generic
  for i in {1..5}; do
    (aplay -q /usr/share/sounds/$BEEPS.wav &) >/dev/null
    sleep 1
  done
  exit $BEEPS_RET
)
I use sub-shell to so the variables don't contaminate the current shell. This may look better by using function, but I started with alias, so continued with alias. If you wants to use function, just replace sub-shell with function, declare the variables are local, replace exit with return.

After I mentioned my favorite command, I want to know what's yours.

In the following form, you will need to enter your favorite command, you can also add second and third most favorite commands as well as top 3 most disliked commands. Each will be given with 5, 3, 1, -5, -3, and -1 points, respectively.



If you can, please elaborate the reasons of your ranking in comment. You can view the spreadsheet and charts:

I had been using BashPad for more than a year since its firstly released. Today, I found one even better, Bashrun via this thread.

http://farm5.static.flickr.com/4097/4912424219_32570e0d0c_z.jpg

There are a few things really impress me:

  • It has separate configuration file (~/$XDG_CONFIG_HOME/bashrun/rc, usually under ~/.config/bashrun), BashPads configuration is tied with the script.
  • It has all features that BashPad has, I think.
  • You can do a lot more with HANDLERS
    • keyword<Ctrl+Alt+g>, search on Google for keyword, or you can gg:keyword.
    • ??foo, show you the man page of foo.
    • You can specify something like '^t gm()$' "$BROWSER 'https://mail.google.com/mail/'", so t gm will bring you to Gmail. Its great way to add bookmarks of websites, I am using this instead of using Fluxbox menu.
    • These above are highly customizable, you can set up any special command you want.

I changed the default terminal to urxvtc and browser to chromium. I tried to use xdg-open at first, but it caused strange thing, xdg-open kept forking itself. May I didnt use it right at first, I was still experimenting.

I added new entry in ~/.fluxbox/apps, so Bashrun will be at center of screen and be on top and now window decoration:

[app] (title=bashrun)
  [Position]  (CENTER)        {0 0}
  [Deco]      {NONE}
  [Layer]     {2}
[end]

Using a bigger font in ~/.Xdefaults:

#########
# Bashrun

bashrun*font: xft:Envy Code R:style=Bold Oblique:pixelsize=20

Keybindings in ~/.fluxbox/keys:

#Mod1 F2 :Exec RUNDIALOG=1 urxvtc -name bashrun
Mod1 F2 :Exec bashrun
Mod4 R :Exec bashrun

You dont need to (and cant, that will cause problem) specify the terminal because Bashrun will bring up the one you specify in configuration.

It works well on my Gentoo, even the developer is from Arch Linux.