Linux Cheat Sheet
Linux Cheat Sheet
whoami
id
uname -a
man top
List available man pages, including a brief description for each command:
man -k .
curl --help
This provides a brief overview of the curl command's usage and options.
date
ls -lrt
pwd
mkdir new_folder
Up one level:
cd ../
To home:
cd ~` or `cd
rmdir temp_directory -v
ps
ps -e
top
df
touch a_new_file.txt
Copy a file:
cp file.txt new_path/new_name.txt
mv this_file.txt that_path/that_file.txt
rm this_old_file.txt -v
chmod +x my_script.sh
Change/modify file permissions to 'execute' only for you, the current user:
chmod go-r
cat my_shell_script.sh
more ReadMe.txt
sort text_file.txt
In reverse order:
sort -r text_file.txt
uniq list_with_duplicated_lines.txt
Lines:
wc -l table_of_data.csv
Words:
wc -w my_essay.txt
Characters:
wc -m some_document.txt
Option Description
Extract lines containing the word "hello", case insensitive and whole words only:
Extract lines containing the pattern "hello" from all files in the current directory ending in .txt:
Suppose you have three files containing the first and last names of your customers, plus their phone numbers.
Use paste to align file contents into a Tab-delimited table, one row for each customer:
Suppose you have a text file whos rows consist of first and last names of customers, delimited by a comma.
Extract the second to fifth characters (bytes) from each line of a file:
Extract the characters (bytes) from each line of a file, starting from the 10th byte to the end of the line:
1 of 2 12/26/2024, 10:22 PM
Firefox https://author-ide.skills.network/render?token=eyJhbGciOiJIUzI1NiIsI...
unzip my_zipped_file.zip
unzip my_zipped_file.zip -d extract_to_this_direcory
Print hostname:
hostname
ping www.google.com
ifconfig
ip
curl <url>
wget <url>
Authors
Jeff Grossman
Sam Propupchuk
Other Contributors
Rav Ahuja
2 of 2 12/26/2024, 10:22 PM