The purpose of this tutorial is to change the hardware clock in Linux. You may have wondered how your Linux system always has the correct date and time when you start up your computer, even if it does not have internet access. How is the computer keeping track of time even when it is powered off?
Luke Reynolds
Setting the timezone under Linux
The objective of this guide is to show how to set the system time zone on Linux. This can be done from both GUI and command line, so we’ll be covering both methods in the following instructions.
Setting your system time and time zone is usually done when initially installing Linux. If you skipped that step during installation, have switched time zones, or your system clock has drifted out of sync, we’ll help you get it fixed.
In this tutorial you will learn:
- How to set time zone via command line (systemd)
- How to set time zone via GNOME GUI
- How to set time zone via KDE GUI
Add character to the beginning of each line using sed
The sed command in Linux can be used to do many types of text manipulation. In this tutorial, you’ll learn how to add a character to the beginning of every line using sed
. Check out the examples below to see how.
Remove or ignore all comment lines from Linux config files
Files on a Linux system often have many lines that are reserved just for comments. In other words, lines that begin with a #
character. This is especially true for Linux configuration files.
Automatically mount USB external drive
The default behavior of most Linux systems is to automatically mount a USB storage device (such as a flash drive or external drive) when it gets plugged into the computer. However, this is not the case across every distro, or sometimes configurations go awry and you may find that your device is not being automatically mounted. You may also just want your storage device to mount when you plug it in before booting.
/etc/network/interfaces to connect Ubuntu to a wireless network
If you want to connect to a wireless network on Ubuntu or any other Debian based Linux distro, one of the many ways to do it is by editing the /etc/network/interfaces
file with your Wi-Fi network info.
This is a command line only method, so it’s very useful if you don’t have a GUI installed on the system but need to get on to the WiFi network.
How to install jdownloader on Ubuntu/Debian Linux
The jDownloader application allows you to download files from many links simultaneously. It comes with handy features like pausing and resuming downloads, extracting contents from compressed archvies automatically, and setting maximum bandwidth usage, among other things to help you manage all of your downloads. It is an open source tool available for Linux systems and will make bulk downloading much easier for you.
Regex match filename
The Linux command line comes with many options that we can use in order to search for files. One of the most powerful features is regex (regular expression) pattern matching. This convention allows us to search our file system based on very granular name patterns found inside the file names – for example, the ability to search for all files that start with an A
and end with a K
. In regex, this would be written ^A.*K$
.
Executing commands remotely with ssh and output redirection
The SSH command can be used to remotely login to a server running an sshd daemon. This allows Linux administrators to perform variety of administrative jobs. However, SSH is more powerful than just providing a user with remote shell access, as it can also be used to automate remote command executions, like running simple backups and downloading the backup file locally.
In this guide, we’ll go over a few different command line examples to show how you can execute commands on a remote system via SSH, as well as direct the output back to your local machine.
In this tutorial you will learn:
- Examples for remote command execution via SSH
How to check a current runlevel of your Linux system
Before systemd came into existence, most major Linux distributions ran a Sys-V style init system. Sys-V used seven different “runlevels” to determine which processes to start on the system. For example, runlevel 3 was typically reserved for the command line and its related programs, whereas runlevel 5 would launch a GUI and all the processes required for it. Results may vary, depending on the distro in question.
These days, the vast majority of Linux distros have adopted systemd as their init system. Some distros still use Sys-V, where the implementation of runlevels as described above still exists. On systemd systems, the concept of runlevels is still alive, but they have been adapted into systemd “targets.”
Remnants of Sys-V still exist on some systems, where commands like runlevel
still work. But some modern systemd distros have eradicated this support completely. In this guide, we’ll show you how to check the current runlevel on Linux.
In this tutorial you will learn:
- How to check the current runlevel
GRUB set password boot protection
One of the best ways to secure your Linux system is by setting a password in GRUB. By having a boot password, no one can boot into your system or access single user mode without supplying a password when the system first turns on.
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.