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 Drop/Delete a Stored Function in PostgreSQL

PostgreSQL drop function

This article will show you how to drop/delete a stored function from a PostgreSQL database. In PostgreSQL, a stored function is a user-definable set of database queries that can be called by name, allowing for easy code re-use. Unlike stored procedures, stored functions require a return value, so they are usually used for calculating values for display, storage, or for further use. Before you Delete a Function from your Database… There are a few things you should do before you remove a stored function from … Read more

How to Drop/Delete/Destroy a Table in PostgreSQL

PostgreSQL drop table

This short tutorial will show you how to completely delete/destroy/drop a table in PostgreSQL using the DROP TABLE statement, and provide examples. Before you Delete a Table… There are a few things you should check before you try and destroy a table in PostgreSQL, especially if you’re working on a production database that is serving users. First and most important, take a backup of your PostgreSQL server – just in case you delete the wrong table, or change your mind later. Next, make sure you’re logged in as the default … Read more

How to Connect to PostgreSQL from the Linux Command Line

How to Connect to PostgreSQL from the Linux Command Line

This short tutorial will show you how to connect to a PostgreSQL database server from the Linux command line. Instructions are included for Ubuntu, Fedora, and Arch Linux. The PostgreSQL Client – psql Command To connect to a PostgreSQL database server from the Linux command, you need to install and use the psql program – the PostgreSQL client. By default, when installing the PostgreSQL server on Linux, the client is also installed – but you may want to install the client without the server if you are only planning … Read more

How to List All Users, Permissions, and Roles in PostgreSQL

PostgreSQL list permissions and roles

This post will demonstrate how to list all users, permissions, and roles on a PostgreSQL database server. Maintaining data security is paramount in any application or database deployment, and making sure users only have access to the data they need is the cornerstone of this security. PostgreSQL has robust user, role, and permission management features, particularly with role based access that allows you to assign permissions to roles, and roles to users, making management tasks more straightforward and reducing the chance of accidentally assigning the … Read more

How Do You Pronounce ‘PostgreSQL’?

How do you pronounce PostgreSQL

This question gets asked quite a lot… How do you pronounce PostgreSQL? For that matter, how do you pronounce SQL? This is often debated among tech-types, this article will take a look at the pronunciations for these two data terms. PostgreSQL is a database management system which uses SQL syntax. As there is argument over how SQL is pronounced, so too is there for PostgreSQL. How Do You Pronounce ‘SQL’? There are two common pronunciations for SQL – pronouncing it like the word “sequel”: …and spelling out the letters: I’m partial to the latter as … Read more

How to List All Databases in PostgreSQL

How to list all PostgreSQL databases

PostgreSQL is one of the most popular open-source database systems. This article will show you how to list all databases in PostgreSQL from the command line with the \l command. Prerequisites To use PostgreSQL, you’ll need to have a PostgreSQL database server set up, and have the psql PostgreSQL command line tools installed. Connecting to the Server If you are running your database on the same machine that you are connecting from and are connecting as the default postgres user, you can simply log in using: If you … Read more

How to Clear the Terminal/Screen in Python

How to Clear the Terminal/Screen in Python

This tutorial will show you several ways to clear the terminal/screen in your Python scripts, with code examples that you can copy and paste into your own project. Clearing the screen will remove all text from the screen, blanking/resetting it. This is useful to hide output from the command line or previous Python statements so that you can more easily see newly added output, and keep your command line apps looking tidy. There are a few ways to achieve this, so here they are: Clearing … Read more

How to Get the Path to the Current Bash/Shell Script

How to Get the Path to the Currently Running Bash/Shell Script in Linux

This short tutorial will demonstrate how to get the path to the currently running Bash/Shell script in Linux, and provide a code example. Getting the path to the current script is useful if you have other files in the same directory as the script that you want to access when calling the script from elsewhere. For example, you may have a script that plays music located with your music files, and have a second script on your Desktop that calls it. The first script will … Read more

How to use the Bash wait Command (it’s Different to sleep)

How to use the Bash wait Command, and How it's Different to sleep

This short post will explain how to use the bash wait command to wait until a process has finished, and how if differs to the sleep command. What does the Bash wait Command Do? The wait command is a simple program that waits for a process to change state – this means waiting for it to exit. How to Use the Bash wait Command The wait command expects a list of process ids that it should wait to complete, for example: Above, the process ids 111 and 222 are supplied to wait. wait will only complete its own execution once the processes supplied to … Read more

How to Check if a String is Empty in Bash Scripts

How to Check if a String is Empty in Bash Scripts

This short article will demonstrate how to check whether a string variable is empty in Bash and other Shell scripts in Linux, with examples. Bash Operators Bash operators are the symbols and expressions that perform comparisons, assignments, and arithmetic. The -z Bash Operator The -z operator returns true if a string variable is null or empty. How the use the -z Bash Operator After declaring a string variable, use the -z operator in an if statement to check whether a string is empty or not: For more Shell scripting tips, check out or Bash/Shell scripting articles!