Skip to content

Posts tagged ‘Terminal Commands’

21
Jun

Custom .screenrc Configuration File

Screen may be the most useful Linux applications when it comes to getting things done through the terminal. This custom screenrc configuration file will provide you with a permanent caption line at the bottom of each window. This caption line will enable you to easily keep track of each terminal window and provide other helpful information such as host and current time.

When screen is invoked, it executes initialization commands from the files “/etc/screenrc” and “.screenrc” in the user’s home directory.

Simply create a file in your home directory with vim or some other editor.

$ vim ~/.screenrc

And place the following line in the file.

caption always "%{Wb} %H %{Bk}| %{Ck}%-w%50>%{Cb} %n %t %{-}%+w%<%{- Wk}%{Bk} | %=%{Wb} %C "

Now launch a new screen session for it to take effect.

26
May

How To Check Which Software Package Is Using More Space

If you’re running out of disk space and you want to quickly see what packages are using the most space on your hard drive, use the following command

dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'

That will sort the packages by size, putting the largest ones on the bottom. If you only want to see the top few, you can type

tail -n 10

at the end, because in all likeliness you have a *lot* of packages installed

26
May

Using Terminal To Check The Size Of A Directory

You can also use a Terminal command to check the size of an individual directory. For instance, if you wanted to check the size of your Documents directory, you would use this command:

du -hs Documents

This will give you the combined size of your Documents folder, along with any subfolders.