Linux: Bash: Kill terminal / console
kill -9 $$
Kills the hosting terminal without allowing it to perform shutdown sequence (like updating history file)
kill -9 $$
Kills the hosting terminal without allowing it to perform shutdown sequence (like updating history file)
There is two ways of doing this:
Either by clicking and holding the icon until it detaches itself from the launcher.
Or by dragging slightly to the right the icon until it detaches itself from the launcher.
See the following video for an example:
In order to print the leading zeros to a variable you need to use the function printf as follows, where %03d states that the number should consist of minimum 3 digits and thus it will put the missing leading zeros:
printf %03d $counter
The following example renames a file that it has the following format for a filename: number.anything and adds the leading zeros in order to make it easier while sorting multiple files.
The name is contained in the variable $a.
If for example we had the file 11.txt it will become 0011.txt
mv $a `printf %04d.%s ${a%.*} ${a##*.}`
Just issue the following in the folder of the source codes and replace ‘FIND ME’ with the string you want to query:
find -O3 . -regex '.*\.\(c\|cpp\|h\)
You can change the contents of the regular expression to search in different file extensions (file types).
-exec grep 'FIND ME!' -sl '{}' \;
You can change the contents of the regular expression to search in different file extensions (file types).