alias

Check .bashrc to ensure .bash_aliases is referenced

add an alias to .bash_aliases

restart bash using exec bash

glob

echo all the files that end in .txt

echo *.txt

echo all files that start with a .

echo .*

This shows the . and .. files, show all other files using this:

echo .??*

grep

find all the instances of the word root in the file /etc/passwd

grep root /etc/passwd

find the word root in every file in the directory /etc/

grep root /etc/*

passwd

change your password using the passwd command

shell variables

explore shell variables

heart=$HOME
echo $heart

restart the shell to clear variable

exec bash

Command-Line keystrokes

ctrl -B Move the cursor left

ctrl -F Move the cursor right

ctrl -P View the previous command (or move the cursor up)

ctrl -N View the next command (or move the cursor down)

ctrl -A Move the cursor to the beginning of the line

ctrl -E Move the cursor to the end of the line

ctrl -W Erase the preceding word

ctrl -U Erase from cursor to beginning of line

ctrl -K Erase from cursor to end of line

ctrl -Y Paste erased text (for example, from ctrl -U)

man -k

search manual keyword pages for the command you want

man -k diff
man -k sort
man -k search
man -k mysql

w

see users on the system

which

which directory is python3 in? nodejs?

I/O

view proc info

head /proc/cpuinfo

redirect proc info to proc.txt

head /proc/cpuinfo > proc.txt

cat the tail proc info

tail /proc/cpuinfo >> proc.txt

tail a file as it gets stuff appended to it

tail -f brothers.txt

Process

common ps idiom

ps aux

show all running processes

ps x

show all processes on the system, not just ones you own

ps ax

include more detailed information on process

ps u

show full command names

ps w

background processes

run a script in the background

python3 script.py &

kill

find the pid using ps

kill pid

chmod

changemode key: 421 = RWX

chmod 666 file.txt

symbolic link

create a symbolic link, -s for symbolic

ln -s target linkname
ln -s /var/www/html/project1 laravel_project

set pwd to a shell variable

DIRVAR=$(pwd)
echo $DIRVAR

check dpkg

pipe it into less

dpkg --list | less