Home » Articles by: Stefan Durand

Python: How to Check Whether a File or Directory Exists

Python How to check whether a file or directory exists

In this article, we explain how to check whether a file or directory exists in Python and include some useful examples to help you get started. Python is a high-level programming language with dynamic semantics. Developed in the early 90s, and named after the Monty Python comedy troupe, it uses simple, easy-to-learn syntax and remains very popular amongst the programming community. It is particularly attractive for Rapid Application Development (RAD) and for its ability to connect existing components together. Python can be used for: server-side … Read more

Home » Articles by: Stefan Durand

Debian: How to Add a User to Sudoers

Debian How to Add a User to Sudoers 1

In the Filesystem Hierarchy Standard used by Linux operating systems, all files and directories appear under the root directory “/” but access to it is often restricted for security reasons. In Linux distributions like Debian, you can gain full access from the SSH by using the “sudo” command. This tutorial explains how to add a user to Sudoers so that the user is permitted to run the sudo command. Logging in as a superuser or root user enables you to make system-wide modifications. “sudo” can … Read more

Home » Articles by: Stefan Durand

How Change the Timezone in Linux

How Change the Time Zone in Linux

Linux is the world’s most widely used open-source operating system (OS). Because Linux is open-source, it means that the code is free and available to the public to view/use. Android, one of the most popular platforms on the planet, is powered by Linux. As such, Linux is used across the world in every time zone. In this article, we’ll explain how time zones work in Linux, and how to change the time zone. Time zones A time zone is a region/area in which the same … Read more

Home » Articles by: Stefan Durand

Linux tr Command with Examples

linux tr command 1

In Linux and Unix systems, tr is a command-line utility that translates, erases, and “squeezes” repeated characters – in fact, tr stands for “translate.” This guide explains how to use the tr command in Linux, with examples. It can be used for operations such as removing repeated characters, converting lowercase to uppercase, and basic replacing and removing of characters. It is often used in conjunction with other commands through piping. Linux is the basic kernel/operating system core behind much of the technology we use on … Read more

Home » Articles by: Stefan Durand

How to Grep for Multiple Words, Strings and Patterns

How to Grep for Multiple Words Strings and Patterns 1

This guide explains how to use the grep utility for searching multiple words, strings, and patterns. You can find full examples of the commands used to accomplish this below. What Is Grep? When we refer to grep, we’re talking about the command-line function. Grep stands for Global Regular Expression Print. In essence, it will search input files looking for lines that are a match to a certain regular expression. It then returns results by writing each line for standard output. The grep utility is suitable … Read more

Home » Articles by: Stefan Durand

How to Get CPU Information on Linux

how to get cpu information linux

Within your computer, the central processing unit, aka the CPU, is a critical component. Despite its essential nature in performing countless data processing functions, many of us likely know very little about the CPU, hidden away inside the computer out of sight as it works its magic. Thankfully, finding CPU information on Linux systems is fairly straightforward, so let’s take a look at how it’s done. Why You Might Need CPU Information There are a few reasons why someone may want to obtain further CPU … Read more

Home » Articles by: Stefan Durand

How to Convert a String to int in Python (and Int to String)

how to convert string int python 1

This article explains how to convert a string into an integer in Python. When you are looking to program with Python, it’s essential that you are aware of the different data types that you may be dealing with. The way your data is stored will depend on which kind of data it is and each kind of data operates in a different manner. Different data types in Python Data types that you’re likely to encounter fall under the categories of numeric, string, and boolean. Simply … Read more

Home » Articles by: Stefan Durand

How to Use the userdel Command to Remove Users in Linux

linux tux

Like most modern operating systems, Linux is designed to be a secure multi-user system. Each system, therefore, needs a system administrator with the ability to manage user accounts. That means creating accounts, assigning privileges to them, and deleting them when they are no longer required. It is always best practice to delete the accounts of dis-continued users (provided that you are sure there is nothing in the account that could be needed again). A user account can consist of numerous things, including the user’s home … Read more

Home » Articles by: Stefan Durand

How to Append to File in Bash

append file bash

There are several ways to append text or new lines to a file using the Bash command line. The majority of them use the double >> to redirect output from another command (such as “echo” or “printf“) into the designated file. An alternative method, using “tee“, can be used when your new text is already available from another input source – usually another text file. Whenever you use any of the redirection methods, always take care not to mistype a single arrow > when you … Read more

Home » Articles by: Stefan Durand

How to Use Split in Python to Split a String

python logo

Python is the world’s second most popular programming language and is the preferred choice of many programmers. It is particularly useful for backend web development, artificial intelligence, data analysis, and scientific computing, but can also be used for creating games and desktop apps. One of the most common questions when it comes to Python is how to split a string. A string in Python is a sequence of Unicode characters, and string variables can be very helpful for Python programmers. They can contain alphanumeric or … Read more