$ find . -type d -iname "*linux*" -o -type f -iname "*linux*"
command | description |
reference |
---|---|---|
pwd | present working directory |
- |
bc | high precision calculator |
$ bc |
cd | change directory |
$ cd - (return to previous directory) $ cd ~ (Navigate to HOME directory) $ cd .. (Move one level up) $ cd / (Move to the root directory) |
ls | lists everything in current directory |
$ ls -la : show all files $ ls *.txt $ ls -R (Lists files in sub-directories as well) |
mkdir / rmdir | make directory or remove directory |
- |
sed | sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline) |
To replace all occurrences of ‘hello’ to ‘world’ in the file input.txt:
`$ sed 's/hello/world/' input.txt > output.txt`
|
echo, cp, rm, mv, touch, locate | basic commands |
$ echo "Hi!" > test.txt $ touch test.txt $ touch test_{1..1000}}_ $ cp test.txt Downloads/ $ rm Downloads/text.txt $ rm -rf Downloads/ $ mv test.txt Downloads/ $ locate golaghat.py |
updatedb | updates the database |
- |
passwd | change system password |
$ passwd
|
awk | It searches one or more files to see if they contain lines that matches with the specified patterns and then perform the associated actions. |
$ awk '{print}' employee.txt (prints every line of data from the specified file.) $ awk '/manager/ {print}' employee.txt (print the lines which match the given pattern) |
man / whatis / tldr | $ man ls : manual of ls |
$ whatis ls (faster man) $ tldr tar |
chmod | change mode - change permission of files and directory |
- is file, d is directory, rwx is read, write & execute, -= is no permission. 3 groups - 1 (owner), 2 (group) and 3 (users). $ chmod +x (give execute permission). $ chmod 777 hello.txt (all group rwx access). $ chmod 766 filename (Assign full permission to the owner, and read and write permission to group and others). |
adduser | add new users |
$ adduser skk $ cat /etc/passwd $ cat /etc/shadow |
/etc/passwd , /etc/shadow | user passwords are stored in /shadow in hash and can be cracked with hashcat. |
$ sudo passwd root |
su | switch user |
$ su skk |
sudo | root priviledges |
- |
ifconfig | information on ipv4, v6, mac address, subnet mask etc |
- |
iwconfig | - |
- |
ping | - |
- |
arp | maps ip addresses to mac addresses |
- |
netstat | display all connections |
- |
route | displays routing table |
- |
echo | echoes in terminal |
$ echo "hello" $ echo "hey" > hey.txt |
cat / tac / shred | prints out what's in a file /in reverse or block/shred |
$ cat hey.txt $ shred hey.txt $ cat << EOF > hey.txt ( type 'EOF' to exit) |
replacing vs appending (> vs >>) | - |
$ echo "hey again" >> hey.txt (to append) |
touch | create a file |
$ touch newfile.txt |
nano / vim | text editor built in terminal |
$ nano newfile.txt $ vim newfile.txt |
gedit | gui text editor |
$ gedit newfile.txt |
ssh user@ip | remote access |
$ ssh -p [port] user@host $ ssh user@host |
ln -s | create soft links |
$ ln -s abc.txt xyz.txt |
clear | clear the terminal |
- |
apropos | get hints for linux commands |
$ apropos email |
whoami / uname -a / neofetch | get username |
$ neofetch |
sudo apt update sudo apt install packagename |
apt is the package manager |
apt-get |
finger | inspect a user |
$ sudo apt install finger $ finger username |
which / whereis | finds address or location of package |
$ which finger $ whereis finger |
wget/ curl addresslink | download content from internet |
- |
zip / tar | zip files |
$ zip filename.zip allfiles.txt $ unzip filename.zip $ tar -cvf filename.tar filename (compress) $ tar -xvf filename.tar (uncompress) |
less, head, tail | check sections of a file |
- |
cmp/ diff file1 file2 | compare or find differences in two files |
- |
cat file.txt | sort | the whole text file sorted |
- |
find | find patterns in files with regex |
$ sudo find / -name "thebible*" $ sudo find . -type f -name "*.*" (find all hidden files) $ sudo find . -type f -empty (empty directories) $ sudo find . perm /a=x (executible files) |
chown username filename | change ownership of file |
- |
grep | grab particular info : grep [pattern] [file_name] |
$ ip address | grep eth0 $ ip address | grep eth0 | inet $ grep pattern files $ grep -i // Case sensitive $ grep -r // Recursive $ grep -v // Inverted search Example: |
cmatrix -a | code matrix -a (asynchronous) |
- |
trash-list / trash-restore | find all files in trash can |
$ sudo apt install trash-cli |
awk | filter for output commands using '{}' |
$ who | awk '{print $1,$4}' |
cat /etc/resolv.conf | DNS info |
$ resolvectl status |
traceroute google.co.in | trace route to destination ip |
- |
ufw | firewall |
$ sudo ufw enable $ sudo ufw status $ sudo ufw allow 80 (allow port 80) $ sudo ufw disable |
cal | system calendar |
- |
free | free memory |
- |
ps / service | processes running |
$ ps -aux $ ps -aux | grep processname |
kill / pkill | kill process with pid |
$ kill pid $ kill -9 pid (-9 is force kill) $ pkill -f nameofprocess |
systemctl | systemctl |
$ sudo systemctl start apache2 $ sudo systemctl status apache2 $ sudo systemctl restart apache2 $ sudo systemctl stop apache2 |
history, reboot, shutdown | basic commands |
- |
progress | check progress of processes |
$ sudo progress |
autojump | jump to directories on the fly |
$ j github $ j .config |
sudo !! | reruns the previous command with a sudo prefix |
$ sudo !! |
dd | Majorly used for creating bootable USB sticks |
- |
wc | Word count |
$ wc file.txt |
alias / unalias wr | Create custom shortcuts for your regularly used commands |
$ alias wr=”cd /var/www/html” |
gpg | Encrypt a file |
$ gpg -c [file_name] |
source | Read and execute the file content in the current shell |
$ source [filename] |
FILESYSTEM NOTES 🔗 | SERVER NOTES 🔗 | NETWORKING NOTES 🔗 | csheet - sheet.pdf 🔗 | 🐞 |
---|
$ sudo chown user dir/
$ sudo chmod u+r+w dir/
$ du -hs * | sort -rh | head -n 10
COMMAND 🔗 | Description |
---|---|
Ctrl + C | Kill current process running in the terminal |
Ctrl + Z | Stop current process |
Ctrl + A | Go to start of a line |
Ctrl + E | Go to end of a line |
Ctrl + W | Cut one word before the cursor and add it to clipboard |
Ctrl + U | Cut part of the line before the cursor and add it to clipboard |
Ctrl + K | Cut part of the line after the cursor and add it to clipboard |
Ctrl + Y | Paste from clipboard |
Ctrl + R | Recall last command that matches the provided characters |
Ctrl + O | Run the previously recalled command |
Ctrl + G | Exit command history without running a command |
!! | Run the last command again |
exit | Log out of current session ................................................ exit |
Available CPU, GPU and mem frequencies [j3tsonDream]:
dream-orin@ubuntu:~$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
115200 192000 268800 345600 422400 499200 576000 652800 729600 806400 883200 960000 1036800 1113600 1190400 1267200 1344000 1420800 1497600 1574400 1651200 1728000 1804800 1881600 1958400 2035200 2112000 2188800 2201600
dream-orin@ubuntu:~$ sudo cat /sys/devices/17000000.ga10b/devfreq/17000000.ga10b/available_frequencies
306000000 408000000 510000000 612000000 714000000 816000000 918000000 1020000000 1122000000 1224000000 1300500000
dream-orin@ubuntu:~$ sudo ls /sys/kernel/debug/bpmp/debug/emc/tables/regular/
204000 2133000 3199000 665600
JetPack release R35.2.1