Shell

How to Set Up SSH Keys on Ubuntu 22.04

How to Set Up SSH Keys on Ubuntu 22.04

Secure Shell Technology or SSH is a network communication protocol that permits two systems to securely communicate in an unsecured network. This cryptographic protocol is also utilized for command–line executables or remote login programs such as terminal applications. Users who want to use SSH for connecting to other remote systems must have SSH configured on …

How to Set Up SSH Keys on Ubuntu 22.04 Read More »

How to prevent a Linux system user from logging into the system

The shell setting in /etc/passwd determines whether a Linux system user may log in via the shell or over SSH. If you don’t want a certain user to be able to log in, set the shell to /bin/false or /sbin/nologin. For the user “otheruser” on Debian and Ubuntu Linux, here’s an example: usermod -s /bin/false …

How to prevent a Linux system user from logging into the system Read More »

Get the name of the newest file in a directory on the linux shell

If you have a directory with many files (a few thousand in my case) and need to know which one is the newest, then the following command might be useful. It returns the name and details of the newest file in a directory where it is executed: ls -tl | sed -n 2p The post …

Get the name of the newest file in a directory on the linux shell Read More »

How to clear Bash history on Linux

The bash history is a log file that contains all commands that the user executed on the Linux shell. When you use the “arrow up” key on our keyboard, then Bash will look up the previous command from that file and display it on the screen, ready to be executed again. Bash history file location The …

How to clear Bash history on Linux Read More »

How to convert filenames or text to lowercase on the Linux command line

There is no simple ‘tolower’ command on the bash, but you can convert uppercase characters to lowercase with a little shell script. The script uses the tr command internally for converting the chars. Create a shell script with the name ‘tolower’ that converts all text that is given as a command-line argument to lower case: …

How to convert filenames or text to lowercase on the Linux command line Read More »