List of Python Escape sequence characters with examples

List of Python Escape sequence characters with examples

When programming in Python, escape characters can be used in order to tell the compiler that it should treat the next character or characters differently. For example, we can tell Python to print a quote " as an actual quote character, rather than interpreting it to be part of the Python code. Other special characters like \t can create TAB spaces, and \n can create new lines. In this tutorial, you will see a list of Python escape sequence characters and examples that you can use on a Linux system.

Read more

How to extend the Thunar file manager with custom actions

How to extend the Thunar file manager with custom actions

Thunar is the file manager included in Xfce, a free and open source Desktop Environment which implements the traditional desktop metaphor, and has become the favorite of many users which switched to it when the GNOME project introduced the GNOME shell. Thunar is light on resources but doesn’t lack functionalities which can be extended further by creating custom actions.

Read more

simple bash script to monitor memory and cpu

Bash script to monitor CPU and Memory usage on Linux

Memory usage on Linux is generally measured in terms of the amount of RAM being used by a particular process. This can be monitored by using the free command which displays the total amount of memory, used memory, and free memory available on the system.

CPU usage on Linux is generally measured in terms of the number of CPU cores being used by a particular process. This can be monitored by using the top command which displays the amount of CPU cores and the total amount of CPU time being used.

Read more

Set and Get environmental shell variable using c++

Set and Get environmental shell variable using c++

Environment variables in the Bash shell can be accessed or set using a C++ program. This is facilitated by the getnenv() and putenv() functions defined in the C/C++ stdlib.h library. Environmental variable expansion is a great feature of a Linux shell as it enables programmers and users to rely on the environment settings of each user separately. C++ getenv() will read all exported environmental variables and putenv() will set existing or create new variables.

Read more

How to integrate dialog boxes in shell scripts with Whiptail

How to integrate dialog boxes in shell scripts with Whiptail

The ability to create secure shell scripts is essential not only for system administrators, but also for users who wants to automate repetitive tasks. Sometimes, from our shell scripts, we need to provide the user with some kind of information, ask him/her to provide some input, choose from a set of alternatives, or just ask for his/her confirmation before performing a potentially dangerous operation. All those actions, can be performed from the command line, of course, but to make our scripts more user-friendly, we can use of Whiptail to customize and display textual widgets.

Read more

Example of simple bash script ftp client

Example of simple bash script ftp client

If you need to use FTP to upload some files to a server every so often and want to save yourself some time, you can make a simple Bash script to transfer the files quickly. Rather than entering the username, password, and directory manually, we can get our Bash script to do this tedious legwork for us. In this tutorial, you will see an example script to make FTP transfers a cinch on a Linux system.

Read more

List of exit codes on Linux

List of exit codes on Linux

When a script or process exits or is terminated by some other means, it will have an exit code, which gives some indication about how or why the script or process ended. For example, an exit code of 0 means that the process exited without error – in other words, it completed its task and exited as expected. On the other hand, an exit code of 1 means that the process encountered some kind of error upon exiting.

Read more