Home » Articles by: Samuel Berry

How to Search in Vim Text Editor

How to Search in Vim

This article explains how to search for words and expressions using Vim. Vim is ubiquitous, some tips and tricks can help you in everyday work life. So! Let’s explore simple searching, with Vim. Find a string Starting in normal mode, press forward-slash (/). Type in the string you’re looking for, and press enter. Press n to find the next occurrence. Once you reach the bottom, Vim loops back to the top. Reverse Search If you want to find all previous occurrences of a word, use … Read more

Home » Articles by: Samuel Berry

Linux cd Command: Change Directory

Linux cd Command Change Directory

This tutorial explains how to use the cd command in Linux to change the directory you are currently in, within the shell. We’ve previously covered how to look around in directories with ls. But now you need to start navigating around the directories. We’ll do that easily with cd, change directory. Let’s start with something simple, how do we learn more about simple baked in utils like cd? If you try: man cd It’ll report, “No manual entry for cd”. Most likely. Instead for baked … Read more

Home » Articles by: Samuel Berry

Linux chmod Recursive: How to Change File Permissions Recursively

Linux chmod Recursive

With the Linux chmod command, we can recursively change file permissions on all files and directories. This guide explains how. It’s likely you’ve run into the following errors before: 111 [Permission Denied] “Linux-Screw” [Permission Denied] “Linux-Screw” [readonly] For any system files, using sudo is the preferred way of editing a file. This allows you to keep all the system context. For everyday use with user files, it’s best to change permissions. chmod can do that for us. It keeps us from needing to escalate permission … Read more

Home » Articles by: Samuel Berry

Vim: How to Find and Replace

vim find and replace

This tutorial explains how to find and replace words in Vim/Vi. Vim provides the substitute command, similar to sed, for replacing text. Let’s go through and look at your options for finding and replacing text in this popular Linux text editor. Vim Syntax #from :help substitute :[range][substitute]/[pattern/{string}/[flags][count] For each line in [range] replace a match of {pattern} with {string}. For the {pattern} see pattern “:help pattern”. For instance if you wanted to replace all instances of Nov & Dec with Jan. :%s/Nov\|Dec/Jan/G When [range] and … Read more

Home » Articles by: Samuel Berry

Linux Change User Password (passwd)

Linux Change User Password

This tutorial explains how to use the Linux passwd command to change a user password or disable an account. You’re assigned a ticket: A simple password reset, but it’s for a Linux machine. What do you need to know to reset a password on Linux? First the basics. For users, the passwd authentication token is store in the /etc/shadow file. For groups, it’s stored in the appropriately named /etc/gshadow file. passwd allows you to change passwords for either. The normal usage of passwd is: Reset … Read more

Home » Articles by: Samuel Berry

ls Command in Linux to List Files and Directories

ls Command in Linux

The ls command in Linux is likely one of the first commands you ever need to use. In this article, we’ll go over the command and commonly used parameters. My preferred set of options is as follows: ls -Zaltrh Let’s dig into each option individually, and explain why the entire glob of options is helpful. Linux LS Command Syntax #ls [OPTION] [FILE] OPTIONS: [-a], do not ignore entries starting with . or .. [-h], with -l, print sizes in human readable format (e.g., 1K 234M … Read more

Home » Articles by: Samuel Berry

Vim / Vi: Deleting lines

Vim / Vi: Deleting lines

This tutorial will teach you how to delete single, blank, or multiple lines in Vim / Vi by using a pattern or range. Vim is ubiquitous, and it’s everywhere. Learning how to edit, remove, yank, paste, and everything else can help you speed through tasks. Before we get started, let’s turn on line numbers: Press ESC (pressing escape brings you into normal mode) Type :set number (brings you into command mode) Line numbers, voila! Simple Deletion The two basic usages of the d-shortcut, delete a single … Read more

Home » Articles by: Samuel Berry

Systemctl: How to List Services (Status, Control, and Tips)

Systemctl: Status, Control, and Tips

In this guide, we explain how to use systemctl to list services and check on their status. We will also cover some of the other uses for systemctl. Coming from run_init service, systemctl is a breath of fresh air. I’m sure there are many reasons I’m wrong and I’ve heard the debates for and against it and changed my mind a few times. After using it daily at work, I’m in the systemctl camp now. The language of the command feels more natural now. On … Read more

Home » Articles by: Samuel Berry

How to Kill a Process in Linux

Killing Processes

There are numerous methods that can be utilized to kill a process in Linux. This tutorial will teach you how to find and kill broken processes. A process can become orphaned easily. Whether on purpose or not, a parent process can crash and leave a child process running. Sometimes, a parent process fails to reap a completed child process, and it becomes a zombie. Both of these processes are stuck and need manual intervention. Enter job control. Let’s take a look at how to kill … Read more

Home » Articles by: Samuel Berry

How to Rename a Directory in Linux

Rename Directories

In this tutorial, we explain how to rename a directory in Linux, using the “mv” and “rename” commands. Renaming directories is not very different from renaming files. Because after all, this is Linux, where everything is a file. Even the directories. So, most of what we discussed with renaming files works here too. Renaming directories with mv mv RenameDir/ renameDir There it is. Just mv it, like the song. Only special concerns, if you have anything directed to the directory. Make sure to search your … Read more