Shell Commands Cheatsheet
Table of contents
Open Table of contents
List of Shell Commands
ls
to list the files and directories in the current directory
ls
# List all files and directories including hidden files
ls -a
# List files and directories with detailed information
ls -l
cd
to change the current directory.
cd path/to/directory
pwd
pwd
command is used to print the current working directory.
pwd
mkdir
mkdir
command is used to create a new directory.
mkdir new-directory
touch
touch
command is used to create a new file.
touch new-file.txt
rm
rm
command is used to remove files or directories.
rm file.txt
cp
cp
command is used to copy files or directories.
cp file.txt new-file.txt
mv
mv
command is used to move files or directories.
mv file.txt path/to/directory
cat
cat
command is used to display the contents of a file.
cat file.txt
grep
grep
command is used to search for a specific pattern in a file.
grep 'pattern' file.txt
echo
echo
command is used to print text to the terminal.
echo 'Hello, World!'
chmod
chmod
command is used to change the permissions of a file or directory.
chmod 755 file.txt
chown
chown
command is used to change the owner of a file or directory.
chown user:group file.txt
ps
ps
command is used to display information about running processes.
ps
kill
kill
command is used to terminate a process.
kill PID
top
top
command is used to display information about running processes in real-time.
top