Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
Remove the “Last login” Message
When you open a new terminal on macOS, you see:
Last login: Mon Dec 26 10:30:00 on ttys000
To remove this message, create an empty .hushlogin file in your home folder:
touch ~/.hushlogin
This works on macOS and Linux.
String Manipulation
Remove First N Characters
Use cut to remove the first 10 characters from a string:
#!/bin/sh
original="my original string"
result=$(echo $original | cut -c11-)
echo $result # outputs: string
The cut -c11- means “start from character 11 to the end”.
Remove Last N Characters
Reverse the string, cut, then reverse again:
#!/bin/sh
original="my original string"
result=$(echo $original | rev | cut -c11- | rev)
echo $result # outputs: my orig
Wildcards
Use wildcards with commands like ls:
ls image* # files starting with "image"
ls *image # files ending with "image"
ls *image* # files containing "image"
Output Redirection
Redirect command output to a file:
ls > filelist.txt # stdout to file
ls 2> errors.txt # stderr to file
ls &> output.txt # both to file
ls >> filelist.txt # append to file
Redirect stderr to stdout:
command 2>&1
Pipes
Send output of one command as input to another:
echo hello | wc # count words
ls | grep ".txt" # filter results
cat file.txt | sort # sort lines
Command Chaining
command1 ; command2 # run both regardless of success
command1 && command2 # run second only if first succeeds
command1 || command2 # run second only if first fails
Customizing Bash
Bash uses different configuration files:
For login shells (servers, TTY):
/etc/profile(system-wide)- Then the first found:
~/.bash_profile,~/.bash_login, or~/.profile
For non-login shells (terminal apps):
/etc/bash.bashrc(system-wide)~/.bashrc
Common things to add to .bashrc:
# Custom prompt
PS1='\u@\h:\w$ '
# Aliases
alias ll='ls -al'
# Add to PATH
export PATH="$PATH:$HOME/bin"
# Environment variables
export EDITOR=vim
Getting Help
Use man for command manuals:
man ls
man grep
For Bash built-ins, use help:
help cd
help echo
Or for a quick reference, install tldr:
tldr ls