⚡
Browse

Useful Bash One-Liners

Learn what common Bash commands and one-liners actually do, in both directions.

Code32 items3 levelsDifficulty 3/5
Start training →

Free · no signup · works on any device

Levels

Start easy — harder levels unlock as you improve, or jump ahead anytime.

1
Basics
8 items
2
Files & Text
11 items
3
Pipelines & Power Tools
13 items

All 32 cards

pwd
→
print working directory
ls -la
→
list all files in long format
cd -
→
go to previous directory
whoami
→
print current username
clear
→
clear the terminal screen
history
→
show command history
man ls
→
show manual page for a command
echo $PATH
→
print the PATH variable
cat file.txt
→
print file contents
grep "pattern" file
→
search for a pattern in a file
wc -l file
→
count lines in a file
head -n 10 file
→
show first 10 lines of a file
tail -f file
→
follow a file as it grows
chmod +x script.sh
→
make a script executable
find . -name "*.txt"
→
find files by name
cp -r dir1 dir2
→
copy a directory recursively
mv old new
→
rename or move a file
rm -rf dir
→
force delete a directory
ln -s target link
→
create a symbolic link
du -sh *
→
show size of each item in a folder
df -h
→
show disk space usage
ps aux | grep node
→
find a running process
kill -9 PID
→
force kill a process
sort file | uniq -c
→
count occurrences of unique lines
awk '{print $1}'
→
print the first column
sed 's/old/new/g' file
→
replace all matches of text
curl -O https://example.com/file
→
download a file
tar -czf archive.tar.gz dir
→
create a gzip-compressed archive
export PATH=$PATH:/new/dir
→
add a directory to PATH
chmod 755 file
→
set read/write/execute permissions
xargs rm < list.txt
→
run a command on each input line
ls | wc -l
→
count files in a directory

Keep going

Vim Commands and Motions

Learn what essential Vim commands and motions do, from basic movement to powerful editing.

Code42 items

Common Git Commands and What They Do

Learn the essential Git commands and the action each one performs.

Code30 items

Essential Linux/Unix Terminal Commands

Master the core Linux and Unix shell commands and recall exactly what each one does.

Code40 items

Regular Expression Tokens and Their Meanings

Master what each common regular-expression token, anchor, and metacharacter matches.

Code37 items