Shell Commands

Try searching for: "list", "docker run", "git branch", "remove directory"
Search Results

Shell Commands

Navigation

pwd

Print the current working directory.

Example: pwd
print working-directory
ls

List files and directories in the current directory.

Example: ls -lah
list files directories
cd <directory>

Change to the specified directory.

Example: cd /usr/local/bin
change directory
cd ..

Move up one directory level.

Example: cd ..
up directory
cd -

Switch to the previous directory.

Example: cd -
switch previous directory

Directories

mkdir <directory>

Create a new directory.

Example: mkdir project
make directory
rmdir <directory>

Remove an empty directory.

Example: rmdir old_folder
remove directory
rm -r <directory>

Remove a directory and its contents recursively.

Example: rm -r build
remove directory recursive
mv <source> <destination>

Move or rename files/directories.

Example: mv old_folder new_folder
move rename
du -sh <directory>

Show disk usage of a directory in human-readable format.

Example: du -sh logs/
disk usage directory

Files

touch <file>

Create an empty file or update its timestamp.

Example: touch README.md
create file timestamp
rm <file>

Remove a file.

Example: rm temp.txt
remove file
cp <source> <destination>

Copy files or directories.

Example: cp -r src/ backup/src/
copy file directory
cat <file>

Display the contents of a file.

Example: cat notes.txt
view file contents
head <file>

Show the first lines of a file.

Example: head -n 10 logfile.log
file head preview
tail <file>

Show the last lines of a file.

Example: tail -f logfile.log
file tail log

Search & Display

find <path> -name "<pattern>"

Search directories for files matching a pattern.

Example: find . -name "*.log"
search find
grep -R "<text>" <directory>

Recursively search files for a text pattern.

Example: grep -R "TODO" src/
search grep
tree

Display directory structure as a tree.

Example: tree -L 2
tree structure
locate <filename>

Quickly find file paths by name (requires updated database).

Example: locate config.yaml
search locate
which <command>

Show the full path of a command binary.

Example: which python3
command path

File Operations

nano <file>

Edit file in terminal text editor.

Example: nano config.txt
edit file nano
chmod <mode> <file>

Change file permissions.

Example: chmod 755 script.sh
permissions chmod file
chown <user>:<group> <file>

Change file ownership.

Example: chown user:group file.txt
ownership chown file

Archives

tar -czvf <archive.tar.gz> <folder>

Create compressed tar archive.

Example: tar -czvf backup.tar.gz documents/
compress archive tar
tar -xzvf <archive.tar.gz>

Extract compressed tar archive.

Example: tar -xzvf backup.tar.gz
extract archive tar
zip -r <archive.zip> <folder>

Create ZIP archive.

Example: zip -r project.zip project/
compress zip archive
unzip <archive.zip>

Extract ZIP archive.

Example: unzip project.zip
extract zip archive

Terminal Helpers

clear

Clear terminal screen.

Example: clear
clear terminal
history

Show command history.

Example: history | tail -10
history commands

Text Processing

grep "<text>" <file>

Search for text pattern in file.

Example: grep "error" logfile.txt
search grep text
wc -l <file>

Count lines in file.

Example: wc -l data.txt
count lines wc
sort <file> | uniq

Sort file and remove duplicate lines.

Example: sort names.txt | uniq
sort unique filter

Processes

ps aux | grep <process>

Find running processes by name.

Example: ps aux | grep nginx
process search ps
top

Display running processes and system resources.

Example: top
process monitor top
htop

Interactive process viewer (if installed).

Example: htop
process monitor htop