• Shorcuts

    There are a lot of shortcuts you can use in the terminal. Lets see a few of them.

    ctr+a: moves the cursor to the beginning of the command line

    ctr+e: moves the cursor to the end of the command line

    ctr+r: search the historical records of your past commands (includes autocompletition)

    As always look for the man system for more information and reference.

  • Export

    This is a basic command in unix systems. It allows us to “export” the environment variables.

    The term “exports” basically means that we can set a group of vars for our session, making them available for the rest of our programs (and any spawned child processes). This includes things like like paths, programs settings, environment specific variables, etc.

    Examples:

    export -p : Will show the variables in the actual session

    export : will show all the exported variables

    export name=value : will export a variable named “name”. To read the value you can do:

    echo $name

    As always read the docs for more info

  • Upower

    Have you ever wanted to know how good or bad is your battery health? You do not want to install complex programs to get that info. Think no more, because Upower comes to the rescue. This nice tool allows you to get information about your battery, showing you a very nice report about it. Just type:

    upower -e

    to list all avalaible devices. And type:

    upower -i "device"

    to get a report

    As always, for more information read the man pages.

  • Gnu – swapoff/on

    This nice tool is capable of disabling the swap system of your computer (file, partition or dedicated device). For instance typing:

    swapoff path/to/file

    will disable your swap file or :

    swapoff /dev/sdbx

    will disable your partition swap. You can revert the changes by writting swapon and the same arguments. As allways read the man manual for more information.

  • GNU -less

    This is an impressive cli command. It does a simple task: show a file content progressively, that is to say, one page at a time. If the file is big this utility is faster than more because it does not have to load the entire file at once, just the first page. You can acces the rest of the document page by page with its own pager system, as if it was a text reader like vim or emacs. The basic sintax is :

    less "filename"

    You can do a ton of things with this utility. The man documentation shows hundreds of options and posibilities. For instance:

    less "filename" -p "text to start"

    command will allow you to open file “filename” and start showing the content when the text “text to start” is found.

    As always, check the man page for more information and options, but be aware that this utility is huge in terms of posibilities.

  • GNU- Uname

    This is a simple command. It give us the system information. It has a few options, as:

    uname -a -> shows all info

    uname - v -> shows kernel version

    uname - o -> shows operating system version

    There are many options, so as always, check the man pages for more info.

  • GNU – touch

    This simple command is able to do a few things. If you read the man description it will tell you this:

    touch - change file timestamps

    so basically this tool changes the timestamp of a file, but it can also do:

    A FILE argument that does not exist is created empty, unless -c or -h is supplied

    which is what people usually use this command for. So the next time you need to create an empty file, in a fast and simple way, just type:

    touch filename

    and a new empty file named filename will be created for you. As allways check the man page for more information

  • Ncdu

    Have you ever wondered what is taking so much space in your hard drives? You have thousands of files but you dont know what is what or where are the biggest files. Well, sometimes you need a way to know what is inside your hard drive. You can achieve this with a beautiful and useful utility: ncdu

    Simply type

    ncdu /

    and you will get something like this:

    88,6 MiB [##########] dockerd
    57,8 MiB [###### ] docker
    40,9 MiB [#### ] containerd
    30,7 MiB [### ] x86_64-linux-gnu-lto-dump-12
    23,7 MiB [## ] x86_64-linux-gnu-lto-dump-11
    23,3 MiB [## ] ctr
    19,6 MiB [## ] containerd-stress
    15,4 MiB [# ] snap
    15,1 MiB [# ] qemu-system-x86_64
    15,0 MiB [# ] qemu-system-i386
    9,8 MiB [# ] gdb
    9,6 MiB [# ] gimp-2.10
    8,0 MiB [ ] gtk4-encode-symbolic-svg
    7,7 MiB [ ] rustdoc
    7,7 MiB [ ] containerd-shim-runc-v2
    7,7 MiB [ ] containerd-shim-runc-v1
    7,3 MiB [ ] ctest
    6,5 MiB [ ] qemu-system-x86_64-microvm
    6,4 MiB [ ] cmake

    That way you have a good representation of every part of your file system. In some distros you need to install the utility as is not installed by default. As always check the man pages for more info.

  • The !! bash command

    There is a not very well known bash command that allows you to repeat the last input you typed in the shell. Behold the “!!” command. This simply allows us to retype the last input. For instance:

    If I type: (to list files in the local directory):

    ls -lh

    and after that I type:

    !!

    It will repeat the “ls -lh” command.

    This comes in handy when you want to script bash in a file. You can also add regex expressions. Imagine you forgot to include the hidden files in your listing, you can replace “lh” with “lha”

    !!:s/lh/lha

    As always, feel free to experiment. And do not forget to check the documentation.

  • GNU – Shred

    Have you ever wanted to delete “permanently” a file from your file system?. Well, you can do it with this command: shred . First, a litle about how a file system works. Simply put, the system keeps a table with references to each file. When you delete a file what really happens is that the operating system removes the reference to the file from the table of references, but the data is still there, so is possible to recover the data. If you really want to delete a file you can use shred. This utility overwrite with random data the file so its unrecoverable. Example: (the u option deletes the file after overwriting)

    shred -u filename

    As always, see the documentation for more options and use cases.