• GNU – duf

    This can be seen as an improvement of the classical command df, that allows us to show the file system disk space usage. If you type df -h (the h option is for human readable) it will show you something like this:

    tmpfs 1,6G 2,8M 1,6G 1% /run
    /dev/nvme0n1p2 468G 222G 223G 50% /
    tmpfs 7,8G 0 7,8G 0% /dev/shm
    tmpfs 5,0M 4,0K 5,0M 1% /run/lock
    tmpfs 7,8G 0 7,8G 0% /run/qemu
    /dev/nvme0n1p1 511M 5,3M 506M 2% /boot/efi

    Nice, but a bit clunky. Instead if you use duf, you will see something like this:

    ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ 3 local devices                                                                                      │
    ├───────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────┬────────────────┤
    │ MOUNTED ON        │   SIZE │   USED │  AVAIL │              USE%             │ TYPE │ FILESYSTEM     │
    ├───────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────┼────────────────┤
    │ /                 │ 467.9G │ 221.9G │ 222.2G │ [#########...........]  47.4% │ ext4 │ /dev/nvme0n1p2 │
    │ /boot/efi         │ 511.0M │   5.2M │ 505.7M │ [....................]   1.0% │ vfat │ /dev/nvme0n1p1 │
    │ /media/user/disc  │ 457.1G │ 333.2G │ 100.6G │ [##############......]  72.9% │ ext4 │ /dev/sda2      │
    ╰───────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────┴────────────────╯
    ╭────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ 7 special devices                                                                              │
    ├────────────────┬──────┬────────┬───────┬───────────────────────────────┬──────────┬────────────┤
    │ MOUNTED ON     │ SIZE │   USED │ AVAIL │              USE%             │ TYPE     │ FILESYSTEM │
    ├────────────────┼──────┼────────┼───────┼───────────────────────────────┼──────────┼────────────┤
    │ /dev           │ 7.7G │     0B │  7.7G │                               │ devtmpfs │ udev       │
    │ /dev/shm       │ 7.7G │     0B │  7.7G │                               │ tmpfs    │ tmpfs      │
    │ /run           │ 1.5G │   2.8M │  1.5G │ [....................]   0.2% │ tmpfs    │ tmpfs      │
    │ /run/lock      │ 5.0M │   4.0K │  5.0M │ [....................]   0.1% │ tmpfs    │ tmpfs      │
    │ /run/qemu      │ 7.7G │     0B │  7.7G │                               │ tmpfs    │ tmpfs      │
    │ /run/snapd/ns  │ 1.5G │   2.8M │  1.5G │ [....................]   0.2% │ tmpfs    │ tmpfs      │
    │ /run/user/1000 │ 1.5G │ 140.0K │  1.5G │ [....................]   0.0% │ tmpfs    │ tmpfs      │
    ╰────────────────┴──────┴────────┴───────┴───────────────────────────────┴──────────┴────────────╯
    

    Which is a much better way to see the information. As always check the man page for more info about this command.

  • GNU – pwd

    Have you ever wondered how to get the path of the working directory?. To do that you can use the command: PWD . This simple order gives you precisely that, the working directory, for instance:

    pwd > returns /home/user/dir

    As always use the man command to get more info about the inner details of this easy but useful tool.

  • GNU – pushd/popd

    This couple of commands are really helpful. It allows you to easily navigate through the system without having to repeat long paths. For example, imagine that you are in the directory /user/data/data2/home/ but want to change to other directory for a moment, say /etc ; you can do:

    pushd /etc -> this will move to /etc and push our directory into the stack. After finish you job in /etc we can type:

    popd -> this will bring us to the original directory

  • Gnu – Flock

    This is an interesting command. Have you ever wanted to be sure that just one instance of your app/script is running at the same time? Then, flock is your tool. The sintax is as follows:

    flock [options] file|directory command [arguments]

    Lets see an example:

    flock /home/user/lockfile htop

    This runs htop and uses a generated file in home/user named lockfile to control the locking. If you try to run the same command, you will not be able to run htop again until the first instance finish.

  • Gnu – Timeout

    This is one of those extremely useful commands that not many people know. Basically runs a shell command and exits when the time runs out. The format is as follows:

    timeout [OPTION] DURATION COMMAND [ARG]…

    Lets see an example:

    • timeout 10s top : This starts the top utility waits for 10 seconds and quit. Simple. The sufixes are:
      • s for second
      • m for minutes
      • h for hours
      • d for days

    As always, check the man page for more details and info.

  • Gnu – w

    Have you ever wonder who is in your system? and doing what? Well, beauty always comes in small packages and today it is not an exception, the only thing you need is: w .This small tool comes to the rescue. The format is as follows:

    w [options] user […]

    Lets see some examples:

    • w -> this command with no parameters shows you all the info you need. This is the output (depends on your system):

    17:37:51 up 7:52, 1 user, load average: 0,44, 0,62, 0,69
    USER TTY LOGIN@ IDLE JCPU PCPU WHAT
    user :0 09:45 ?xdm? 1:23m 0.00s /usr/libexec/gdm-x-session --run-script /usr/bin/gnome-session

    lets see what we have here:

    1. 17:37:51 -> current time
    2. up 7:52 -> how long the system has been running
    3. 1 user -> how many users are currently logged on
    4. load average: 0,44, 0,62, 0,69 -> the load average the past 1, 5 and 15 minutes respectively
    5. Then, for each user logged into the system we have one row showing:
      1. user-> login name
      2. :0 -> the tty name
      3. From -> this field only appears if the user is connected through a remote ssh conection. In this example do not appears because the user is local
      4. 09:45 -> login time
      5. ?xdm? -> idle time (usually for remote users, if the user is local, shows xdm, the display manager)
      6. JCPU -> is the time used by all processes attached to the tty
      7. PCPU -> is the time used by the current process (the one in the what field)
      8. /usr/libexec… -> command line of the current process

    That is a lot of info for just w !

  • Gnu – ls

    This command allows you to list files and directories (dir in Ms-dos world). Lets see how this works.

    The format is as follows:

    ls [OPTION]… [FILE]…

    You can type ls as is to show a barebones listing of files and directories. Lets see more possibilities:

    • ls -l -> this shows the long listing format (its a compact way to show the info)
    • ls -a -> shows only the hidden files (the ones starting with a dot)
    • ls -la -> shows all files in listing format plus, the hidden ones
    • ls -i -> shows inode information about the files (info about the file system)
    • la -lh -> shows files and details in human readable format
    • ls -lha -> You get the idea, you can combine the options to get the result that you want, with this you get details in human readable format plus hidden files

    As you can see there are many combinations. Those here are just a tiny fraction of what is possible with this command. If you want more info, type man ls to see the full list of options.

  • New programming languages

    To choose a programming language is always a difficult task. In theory it is just a tool to solve a problem but in practice it is much more than that. Platforms, library support, community etc can greatly influence the time and effort to develop a product, I have tried many programming languages and in general I would say there is a clear improvement Lately. First I thought javascript would be the only language to rule them all, but after a few years dealing with extremely fast moving frameworks, excessive complexities of the language itself -think about the craziness of «this»– and a bunch of patches in the form of a thousands tools to deal with what the language was not designed for I quit.

    Looking for a replacement I tried Go but it was not my cup of tea. I like many things about Go -simplicity- but I also dislike a lot, like the tediousness of some tasks, no class system etc. Rust is too complex for my liking -see c++– and I do not like Java either. There are a few newcomers that can bring hope though: kotlin and Dart:

    I have always wanted a better language for general computing and I think Dart fits the sweet spot between capabilities and easiness of use. Kotlin offers the same but in another level, It is a much more rich and complex language. I will be trying both and sharing my experiences.

    Anyway, maybe the point it is not about the language itself but the results: things like the graalvm virtual machine .net o wasm are the way to go. Pick the language of your choice, be Go, Rust, C#, ruby etc and let the virtual machine do the rest, support, libraries etc.