BASH Loops

Bash supports both while and for loop. Each has some variants to help us do our work better!

Remove kerenels

Every time Debian installs new kernel, old ones are not removed. These days we have large capacity hard drives. So it may fell like not important issue. Unfortunately, hard drive is divided into partitions with limited space. One of them is /boot partition which, among the others, store configs and other files that allows booting different kernels. The more kernels we have, the more space is required for /boot partition.

Clear shell history

Different shells provides similar, yet not the same methods to clear history. This feature is extremely useful if either by accidence or by command requirements, we typed secrets / passwords or other confidential data.

ALT Codes

ALT Codes are special codes that allow inserting characters that may not be available on keyboard on Windows system. Numeric keyboard required. If your keyboard do not have numeric part on right side, then it won’t work. I know it’s sad but true.

How to beep

If there is a need for user of a script to react when task is ready (or failed), there are some options: keep eye on script, check from time to time, get notification or play a sound.

AWK split input by…

awk is designed to process text for reports. Let’s think about different methods of splitting text.

GIT — cherry-pick

git cherry-pick is a simple method for applying the same changes into multiple branches. It’s enough to do changes once, then copy commit into different places.

Pipes in shell

Shells allows easy forwarding of output form one program to input of another program. It is also available in other languages. General term for such phenomena is piping or pipelining.

Bash reusing parameters – BANG (!)

Bash allows us to reuse parameters or even whole command. It seams to be nothing, but in reality it helps a lot. Let’s start with examples.

BASH & multithreading

If you need to perform two or more time consuming jobs, and these jobs can be run independently, you can still use BASH.

git — ignore changes

If there are changes that you need to ignore, but you can’t or doesn’t want to edit neither .gitignore_global nor .gitignore files, there is still hope for you. In repository there is file:

Sudo with env variables

Sudo command allows us running command as other user. Some commands or programs relay on environment variables. There is no problem if those variables are set properly. Situation complicates when required variables are not set or have other values than required.

VIM viewports — splitted window

Vim seams to be simple and without many features. But it’s just false first impression. One of “hidden” feature is splitted window.

Convince Eclipse to use other JavaVM than default

Just edit eclipse.ini file (macOS path: /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini). In this file, somewhere before -vmargs add:

.tar.gz — compress & uncompress

Quickly create tar.gz archive:

ALL ARTICLES

Click for more