This tutorial explains how to check the version of Python that is installed on your system. The commands work on Windows, Linux & macOS, and with Python2 or Python3. Python is an incredibly popular and powerful programming language worldwide for everything from website development, content… Read More »Check Python Version (Windows, Linux & macOS)
My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.
This tutorial will teach you how to find the length of a list (array) in Python using some code examples. There are four data structures built into Python: tuples, sets, dictionaries, and lists. They are important for programmers because they allow for iteration over their… Read More »How to Get the Length of a List in Python
Even outside of programming, people perform list reversal regularly, for example, to re-order eBay items from high to low then low to high. It is a handy operation, and Python provides several ways to accomplish it. Method 1: Using the built-in reverse() function This method… Read More »How to Reverse a List in Python
Q: How can I disable one or several keys on my laptop keyboard in Linux? When I press the DELETE key, it gets stuck and deletes everything 🙂
A: No problem! You can use the following command to remap or disable any key of your keyboard:
xmodmap -e 'keycode <value>=<action>'
For example, you could run the following command to disable your DELETE key:
xmodmap -e 'keycode 107='
How to get the correct keycode
You can get the keycode that corresponds to a specific keyboard button in one of two ways.
The first method is by using the simple command xev. xev opens a window and then monitors “events” such as keystrokes. It is suitable when you are running a GUI.
The second method, which can be run with only the console, is showkey. This command will monitor for keystrokes for 10 seconds, or until a SIGTERM signal is received.
List of all keycodes
The full list of available keycodes and actions assigned to them on UK keyboard is below…
Read More »FAQ: How to disable/remap a keyboard key in Linux?
In this tutorial, we explain how to use the cp command in Linux to copy files or directories. Examples are included below. Linux is one of the most popular Operating Systems on the planet and is the basis for all Android devices. It is open-source… Read More »Linux cp Command: How to Copy Files and Directories
In this tutorial, we explain the two methods used to make multiline comments in Python, with examples. There are some drawbacks to one of the methods, so pay attention. Code without comments is like a story written in a language you only half understand. You… Read More »How to Make Multiline Comments in Python
In this guide, we explain how to save a file and quit/exit in Vim, how to save a file without exiting, and how to quit/exit without saving. Vim (Vi IMproved) is an open-source text editor for Unix or Linux. It’s used to write and edit… Read More »How to Save a File and Quit in Vim/Vi
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… Read More »Python: How to Check Whether a File or Directory Exists
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… Read More »Debian: How to Add a User to Sudoers
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,… Read More »How Change the Timezone in Linux