Bash (shell) 🐚

The term “shell” in Unix comes from a simple metaphor: it acts as a protective outer layer around the system’s core. - ChatGPT

# Run multiple commands and kill them all ⮺

use subshells with background commands.

(command1 & command2 & command3)

# redirect sudo output ⮺

Run a shell with sudo and give the command to it by using the -c option

sudo sh -c 'ls -hal /root/ > /root/test.out'

Create a script with your commands and run that script with sudo

#!/bin/sh
ls -hal /root/ > /root/test.out

# .profile vs .bashrc ⮺

.profile → for login shells (and often your graphical login session): set up your environment.
.bashrc → for interactive non-login Bash shells: configure your shell experience

login
  |
  +--> .profile
          |
          +--> export PATH
          +--> export EDITOR
                  |
                  +--> terminal
                          |
                          +--> bash
Written on August 17, 2019, Last update on
bash cli shell