Tag: Linux
-
cat a file and remove comments and blank lines
$ cat file.txt | grep -v “#” | grep -v “^$”
-
Installing multiple packages from a list
cat packages.txt | xargs sudo apt-get install -y
-
Find and replace text within a file using sed
Find and replace text within a file using sed The procedure to change the text in files under Linux/Unix using sed: Use Stream EDitor (sed) as follows: sed -i ‘s/old-text/new-text/g’ input.txt The s is the substitute command of sed for find and replace It tells sed to find all occurrences of ‘old-text’ and replace with…
-
Installing Visual Studio Code on RHEL
RHEL, Fedora, and CentOS based distributions We currently ship the stable 64-bit VS Code in a yum repository, the following script will install the key and repository: sudo rpm –import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c ‘echo -e “[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc” > /etc/yum.repos.d/vscode.repo’ Then update the package cache and install the package using dnf (Fedora 22 and…
-
Find out more about Ansible
https://www.ansible.com/resources/get-started
-
Crontab explained
-
What does the number in parentheses mean in manpages
It’s the section that the man page for the command is assigned to. # man 1 man # man 3 find or # man -s 1 man depending on your OS
-
format a disk to fat32 on raspberry pi or linux
—— part 1 ——- create partitions 1) get list of disks # fdisk -l 2) Find disk in list, /dev/??? in this example /dev/sda 3) run fdisk again and specify disk # fdisk /dev/sda 4) print current partiions Command (m for help): p 5) use the d command to delete any of the existing partitiond…
-
Cannot boot because missing external disk
See man pages fstab(5) and mount(8). Using the nofail mount option will ignore missing drives during boot. nofail Do not report errors for this device if it does not exist. So your fstab line should instead look like: UUID=6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external ext4 defaults,nofail 0 0
-
Creating and extending Linux LVMs
Notes on how to create or add disk, volume groups and logical volume in Linux (RedHat) 1. First add disk to system by what ever means your system requires. 2. Find name of disk using fdisk # fdisk -l /dev/sd* | grep i ‘Disk’ For my examples below, it would have listed sdb but not…