-
Notifications
You must be signed in to change notification settings - Fork 0
LINUX
-
ls: A command for listing the contents of a directory. Example usage: ls /home/user
-
cd: A command for changing the current working directory. Example usage: cd /home/user/Documents
-
pwd: A command for printing the current working directory. Example usage: pwd
-
mkdir: A command for creating a new directory. Example usage: mkdir new_directory
-
rm: A command for deleting files and directories. Example usage: rm file.txt
-
cp: A command for copying files and directories. Example usage: cp file.txt /home/user/Documents
-
mv: A command for moving or renaming files and directories. Example usage: mv file.txt new_name.txt
-
cat: A command for displaying the contents of a file. Example usage: cat file.txt
-
less: A command for displaying the contents of a file in a scrollable view. Example usage: less file.txt
-
head: A command for displaying the first lines of a file. Example usage: head file.txt
-
tail: A command for displaying the last lines of a file. Example usage: tail file.txt
-
grep: A command for searching for a specific pattern in a file. Example usage: grep pattern file.txt
-
find: A command for searching for files or directories. Example usage: find /home/user -name file.txt
-
chmod: A command for changing the permissions of a file or directory. Example usage: chmod 755 file.txt
-
chown: A command for changing the owner of a file or directory. Example usage: chown user:group file.txt
-
ssh: A command for connecting to a remote host over SSH. Example usage: ssh user@host
-
scp: A command for copying files between local and remote hosts over SSH. Example usage: scp file.txt user@host:/path/to/destination
-
tar: A command for creating and manipulating archive files. Example usage: tar -cvf archive.tar file1 file2
-
gzip: A command for compressing and decompressing files. Example usage: gzip file.txt
-
top: A command for monitoring system processes and resource usage. Example usage: top
-
ps: A command for displaying information about running processes. Example usage: ps aux
-
kill: A command for terminating a process. Example usage: kill PID
-
df: A command for displaying disk usage. Example usage: df -h
-
du: A command for displaying the size of files and directories. Example usage: du -sh /path/to/directory
-
apt-get: A command for managing packages on Debian-based Linux distributions. Example usage: sudo apt-get update
-
yum: A command for managing packages on Red Hat-based Linux distributions. Example usage: sudo yum update
-
ping: A command for testing network connectivity. Example usage: ping google.com
-
traceroute: A command for tracing the route of network packets. Example usage: traceroute google.com
-
ifconfig: A command for displaying and configuring network interfaces. Example usage: ifconfig
-
ip: A command for displaying and configuring network interfaces, routes, and addresses. Example usage: ip addr show
-
whoami: A command for displaying the current user. Example usage: whoami
-
sudo: A command for executing a command with elevated privileges. Example usage: sudo apt-get update
-
useradd: A command for creating a new user account. Example usage: sudo useradd -m newuser
-
usermod: A command for modifying user account attributes. Example usage: sudo usermod -aG sudo newuser
-
passwd: A command for changing the password of a user account. Example usage: passwd newuser
-
history: A command for displaying the command history. Example usage: history
-
alias: A command for creating and displaying command aliases. Example usage: alias ll='ls -alF'
-
date: A command for displaying the current date and time. Example usage: date
-
cal: A command for displaying a calendar. Example usage: cal
-
who: A command for displaying the users currently logged in. Example usage: who
-
uptime: A command for displaying the system uptime. Example usage: uptime
-
hostname: A command for displaying the hostname of the system. Example usage: hostname
-
df: A command for displaying disk space usage. Example usage: df -h
-
free: A command for displaying the amount of free memory. Example usage: free -h
-
mount: A command for mounting a file system. Example usage: sudo mount /dev/sdb1 /mnt
-
umount: A command for unmounting a file system. Example usage: sudo umount /mnt
-
chroot: A command for changing the root directory. Example usage: sudo chroot /mnt
-
ln: A command for creating links between files. Example usage: ln -s /path/to/file /path/to/link
-
lsof: A command for displaying information about open files. Example usage: sudo lsof /path/to/file
-
ssh-keygen: A command for generating SSH keys. Example usage: ssh-keygen -t rsa -b 4096 -C "user@host"
-
ssh: A command for connecting to a remote server over SSH. Example usage: ssh user@host
-
scp: A command for securely copying files between hosts. Example usage: scp /path/to/file user@host:/path/to/destination
-
rsync: A command for efficiently synchronizing files between hosts. Example usage: rsync -avz /path/to/source user@host:/path/to/destination
-
ps: A command for displaying information about running processes. Example usage: ps aux
-
top: A command for displaying information about the top CPU-consuming processes. Example usage: top
-
kill: A command for terminating a process. Example usage: kill 1234
-
pkill: A command for terminating a process by name. Example usage: pkill firefox
-
jobs: A command for displaying a list of background jobs. Example usage: jobs
-
bg: A command for running a job in the background. Example usage: bg %1
-
fg: A command for bringing a job to the foreground. Example usage: fg %1
-
cron: A command for scheduling jobs to run at specified intervals. Example usage: crontab -e
-
at: A command for scheduling a job to run at a specified time. Example usage: at now + 1 hour
-
curl: A command for transferring data from or to a server. Example usage: curl https://example.com
-
wget: A command for downloading files from the web. Example usage: wget https://example.com/file
-
ping: A command for testing network connectivity. Example usage: ping 8.8.8.8
-
traceroute: A command for displaying the path packets take to a destination. Example usage: traceroute google.com
-
route: A command for displaying and modifying the system routing table. Example usage: sudo route add default gw 192.168.0.1
-
ifconfig: A command for displaying network interface information. Example usage: ifconfig
-
ip: A command for displaying and modifying IP address information. Example usage: ip addr show
-
netstat: A command for displaying network connections and statistics. Example usage: netstat -tulpn
-
iptables: A command for configuring and managing firewall rules. Example usage: sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
-
systemctl: A command for managing system services. Example usage: sudo systemctl status sshd
-
journalctl: A command for querying and displaying system logs. Example usage: sudo journalctl -u sshd
-
find: A command for searching for files in a directory hierarchy. Example usage: find /path/to/dir -name *.txt
-
grep: A command for searching for text patterns in files. Example usage: grep 'pattern' /path/to/file
LINUX SCRIPT COMMANDS:
-
echo: A command that displays a message on the terminal. Example usage: echo "Hello World"
-
read: A command that reads a value from the user and stores it in a variable. Example usage: read NAME
-
if: A command that allows you to execute different commands depending on whether a condition is true or false. Example usage: if [ $NAME == "Alice" ] then echo "Hello Alice" else echo "Hello $NAME" fi
-
for: A command that allows you to execute a command for each element in a list. Example usage: for i in 1 2 3 4 5 do echo $i done
-
while: A command that allows you to execute a command repeatedly while a condition is true. Example usage: while [ $i -lt 10 ] do echo
$i i=$ ((i+1)) done -
case: A command that allows you to execute different commands depending on the value of a variable. Example usage: case $i in
echo "One"
;;
echo "Two"
;;
*) echo "Other" ;; Esac
-
export: A command that allows you to set an environment variable that will be available to child processes. Example usage: export PATH=$PATH:/usr/local/bin
-
source: A command that allows you to execute a script in the current shell, rather than creating a new shell. Example usage: source script.sh
-
alias: A command that allows you to create a shortcut for a longer command. Example usage: alias ll='ls -alF'
-
function: A command that allows you to define a function that can be called like a command. Example usage: function greet { echo "Hello $1" }
greet "Alice"
-
break: A command that allows you to exit out of a loop. Example usage: for i in 1 2 3 4 5 do if [ $i -eq 3 ] then break fi echo $i done
-
continue: A command that allows you to skip an iteration of a loop. Example usage: for i in 1 2 3 4 5 do if [ $i -eq 3 ] then continue fi echo $i done
-
return: A command that allows you to return a value from a function. Example usage: function add { return $(($1 + $2)) }
sum=$(add 2 3) echo $sum
-
basename: A command that allows you to get the base name of a file. Example usage: basename /path/to/file.txt
-
dirname: A command that allows you to get the directory name of a file. Example usage: dirname /path/to/file.txt
-
touch: A command that allows you to create a new empty file or update the modification time of an existing file. Example usage: touch new_file.txt touch existing_file.txt
-
chmod: A command that allows you to change the permissions of a file. Example usage: chmod 755 script.sh
-
chown: A command that allows you to change the owner of a file. Example usage: chown alice:users file.txt
-
ln: A command that allows you to create a link to a file. Example usage: ln -s /path/to/file.txt link.txt
-
sed: A command that allows you to perform text transformations on a file. Example usage: sed 's/foo/bar/g' file.txt
-
awk: A command that allows you to extract and manipulate data from a file. Example usage: awk '{ print $1 }' file.txt
-
grep: A command that allows you to search for a pattern in a file. Example usage: grep 'pattern' file.txt
-
cut: A command that allows you to extract columns of text from a file. Example usage: cut -f 1,3 -d ',' file.csv
-
sort: A command that allows you to sort the lines in a file. Example usage: sort file.txt
-
uniq: A command that allows you to remove duplicates from a file. Example usage: uniq file.txt
-
tee: A command that allows you to write to a file and also output to the terminal. Example usage: echo "Hello World" | tee file.txt
-
head: A command that allows you to display the first few lines of a file. Example usage: head file.txt
-
tail: A command that allows you to display the last few lines of a file. Example usage: tail file.txt
-
cat: A command that allows you to concatenate files and output them to the terminal. Example usage: cat file1.txt file2.txt
-
xargs: A command that allows you to pass the output of one command as arguments to another command. Example usage: find . -name "*.txt" | xargs grep "pattern"
-
tr: A command that allows you to translate characters in a file. Example usage: tr 'a-z' 'A-Z' < file.txt
-
expr: A command that allows you to perform arithmetic operations. Example usage: expr 2 + 3
-
bc: A command that allows you to perform floating point arithmetic operations. Example usage: echo "scale=2; 5/2" | bc
-
date: A command that allows you to display or set the system date and time. Example usage: date
-
cal: A command that allows you to display a calendar for the current month or year. Example usage: cal
-
bc: A command that allows you to perform floating point arithmetic operations. Example usage: echo "scale=2; 5/2" | bc
-
cut: A command that allows you to extract columns of text from a file. Example usage: cut -f 1,3 -d ',' file.csv
-
sort: A command that allows you to sort the lines in a file. Example usage: sort file.txt
-
uniq: A command that allows you to remove duplicates from a file. Example usage: uniq file.txt
-
paste: A command that allows you to merge lines from multiple files. Example usage: paste file1.txt file2.txt
-
dirname: A command that allows you to get the directory name of a file. Example usage: dirname /path/to/file.txt
-
basename: A command that allows you to get the base name of a file. Example usage: basename /path/to/file.txt
-
cut: A command that allows you to extract columns of text from a file. Example usage: cut -f 1,3 -d ',' file.csv
-
wc: A command that allows you to count the number of lines, words, and characters in a file. Example usage: wc file.txt
-
head: A command that allows you to display the first few lines of a file. Example usage: head file.txt
-
tail: A command that allows you to display the last few lines of a file. Example usage: tail file.txt
-
echo: A command that allows you to display a message on the terminal. Example usage: echo "Hello World"
-
sleep: A command that allows you to pause the execution of a script for a specified amount of time. Example usage: sleep 5
-
read: A command that allows you to read input from the user. Example usage: echo "What is your name?" read name echo "Hello, $name!"
-
seq: A command that allows you to generate a sequence of numbers. Example usage: seq 1 10