Welcome to LinuxScrew

A site for Linux lovers worldwide. For newbies, system engineers, administrators, and everybody in between. We cover all things Linux, plus various programming languages, including Python, Javascript, and PHP.

View our featured tutorials and projects in the slider below or scroll down to see all recent articles.

How to Convert a USB Printer to Wireless with a Raspberry Pi
How to Use a Raspberry Pi for Digital Signage
The Worst Things You’ll Probably Google As a Programmer on Linux
How to Build a Raspberry Pi Internet Kiosk
Browsing the Internet on a 1989 Macintosh II with a Web Rendering Proxy
previous arrow
next arrow
Slider

How to Export and Back Up PostgreSQL Databases

PostgreSQL Backup Import Export

This tutorial will show you how to export, import, and back up your PostgreSQL clusters and databases. You should regularly back up. It’s one of the most important things you can do as a sysadmin, developer, and even a hobbyist. Losing your data is detrimental to business, and your projects. Losing your family photos sucks too. This article demonstrates the various way to import and export PostgreSQL data so that it can be backed up. This process should be done regularly (or automated!), and performed … Read more

How to Import a CSV File to PostgreSQL

PostgreSQL Import CSV File

This tutorial will show you how to import data from a CSV file into a PostgreSQL database table. What is a CSV File A CSV (Comma Separated Values) file is a text file that contains tabulated information. The rows in this data each take up a line in the text file, while the values in each column on each row are separated by a comma – hence, comma-separated. CSV files are versatile. Because the data within is stored as plain text, they can be opened … Read more

LibreNMS: What is it and how does it work?

LibreNMS gUIDE

This article covers the LibreNMS network monitoring tool, from installation and configuration to features and usage. Introduction to LibreNMS LibreNMS is a powerful open-source network monitoring solution that can be used to monitor devices and services on your network. It offers a wide range of features, including support for a variety of protocols, performance monitoring, alerts, and more. LibreNMS is easy to install and configure, and it can be used on a variety of platforms. In this guide, we will cover the basics of LibreNMS, … Read more

Bash Split String (+ Shell Scripts)

Bash Split String

This article will show you how to split a string at a given delimiter in Bash/Shell scripts and show some examples. Splitting strings is a handy function to have available when crafting your scripts. CSV (Comma Separated Values) is a common format in which data is made available online, where data fields in a table are separated by (surprise) commas. You may also simply be looking to split a sentence into words at the spaces, or split paragraphs into sentences at the period, and so … Read more

Printing Text in Python Without a Newline

Python print without newline

This short tutorial will show you how to print text in Python, without a new line appearing. The Newline Character in Python In Python, newlines are represented by a \ (backslash) followed by n: \n You Can Add New Lines to Printed Strings The \n won’t be shown to the user – a new line will be inserted instead (unless an escape character is added). So, when the below code is executed: print(“Linux\nScrew”) It will appear as: Linux Screw Print Statements Add a Newline By Default By default, a newline … Read more

How to Run an SQL File in MySQL (or MariaDB) on Linux/Ubuntu

How to Run a SQL File in MySQL/MariaDB on Linux/Ubuntu

Here is an article outlining several methods for running SQL files in MySQL on Linux/Ubuntu. Whether you’re installing a package, following a tutorial, or restoring a backup – it’s useful to be able to execute an SQL script from a file and have it do all of the work for you, rather than having to type it all out. Most GUI database managers have a simple import option prominently displayed in the menu bar – so here’s how to do it from the command line … Read more

How to Read CSV Files in Python, With Examples

Python read from csv file

This article will show you how to read CSV (Comma Separated Values) files in the Python programming language, with examples. What is CSV (Comma Separated Values) CSV (Comma Separated Values) is a format for storing and transmitting data, usually in a text file, in which the individual values are separated by a comma (,). Each row in a CSV file represents an individual record containing multiple comma separated values. A CSV file looks like this: name,age,favourite colour Fred,54,green Mary,31,pink Steve,12,orange Above, the CSV describes three people, with information … Read more

Use wc to Count the Characters/Words/Lines [Linux/Bash]

Bash wc command count words

The wc program can be used in Bash scripts and from the Linux command line to count the number of bytes, characters, words, or lines in a file. Here’s how to use it, with examples. wc Program Syntax The syntax for the wc command is as follows: wc OPTIONS FILE Note that: OPTIONS should be provided from the below table of available options FILE is the path to the file which will have the contents counted More than one file can be specified If more than one file is specified, the total … Read more

Python setAttr() – What it Does and How to Use It [Examples]

Python use setattr() to set object attributes

The setattr() function is used to set the value of an attribute of an object. Here is how it is used, with examples. Python Objects and Classes Python is an object oriented programming language. Object oriented means that rather than code being written as a list of instructions, accumulating data and passing the results to the following lines of code (known as procedural programming), data and functionality is contained within the objects it describes. Each object is a self-contained representation of something, that can be modified, and passed between functions … Read more

JavaScript for Loops – How to Use Them [Examples]

How to use for loops in JavaScript

This article will show you how to use the simplest JavaScript loop – the for loop, and provide code examples. JavaScript for Loops JavaScript’s for loops are used to execute a block of code repeatedly until a condition is met. The initial variables, condition that must be met, and the expression which progresses the loop are all defined within the loop expression. for loop Syntax JavaScript for loops follow the following syntax: for (INITIALIZATION; CONDITION; FINAL_EXPRESSION) { //Code to be executed in the loop } Note that: INITIALIZATION sets the variable which is used to control … Read more