2-cat: scroll off and display the end of pages more: display output one screen at one time (page by page) 3-rm: to remove files rmdir: to remove directory 4-/home --> mkdir dir1 doc /home/dir1 --> mkdir dir11 dir12
/home/doc --> touch mycv /home/dir1/dir11/ --> touch file1
4-a-rmdir dir11
4-b- rmdir -p
4-c- home ./home
5-cp etc/passwod home/mypasswod
6-mv mypasswd oldpasswd
7-../../home or cd /home or cd ~home or cd-home 8-ls /usr/bin/w*
9-head -n 4 /etc/passwd
10-tail -n 7 /etc/passwd
11- man passwd && cat /etc/passwd
12-man 5 passwd
13-man -K passwd
1-sudo useradd -c "islam asker" -m islam
sudo passwd islam
2-sudo useradd -c "Bad User" -m baduser sudo passwd baduser
3-sudo groupadd -g 30000 pgroup
4-sudo groupadd -g 20000 badgroup
5-sudo usermod -aG pgroup islam
6-sudo passwd islam
7-sudo chage -M 30 islam
8-sudo usermod -L baduser
9-sudo userdel -r baduser
10-sudo groupdel baduser
13-mkdir ~/myteam chmod 400 ~/myteam
14-su islam
15-sudo cd ~/myteam
16-1-sudo touch oldpasswd chmod u=rw,g=wx,o=x oldpasswd chmod 711 oldpasswd
16-2-16 -2 Default permissions for files: 666 (rw-rw-rw-) Default permissions for directories: 777 (rwxrwxrwx)
16-3-umask 077 mkdir testdir touch test
1- vi mycv
2- a. Move the cursor down one line at a time:
Press j
b. Move the cursor up one line at a time:
Press k
c. Search for the word "age":
Type /age and press Enter
d. Step to line 5:
Type :5 and press Enter
e. Delete the line you are on and line 5:
Type dd to delete the current line
Type :5 and press Enter to move to line 5
Type dd to delete line 5
f. Step to the end of the line and change to writing mode in one step:
Press $ to move to the end of the line
Press A to enter insert mode at the end of the line
3-cat /etc/shells
4-env
5-printenv
6- echo $HOME
7-echo $SHELL
8-whereis sh whereis ksh whereis bash
9-nano ~/.bashrc
echo "Welcome,
10-
enter echo \ and press Enter.
The shell sees the backslash as an escape character, so it expects that the command is not complete and waits for more input.
The shell shows a continuation prompt, which is often >, indicating that it's waiting for additional input to complete the command.
So, the continuation prompt (>) is telling you that the command you entered is not yet complete, and the shell is waiting for more input.
To change the continuation prompt from > to :, you can use the PS2 variable. This variable controls the secondary prompt (the continuation prompt). You can set it in your shell configuration file, such as ~/.bashrc.
11-alias ls="ls -l"
1-compress file gzip -v file1 zip -v file2
file extention: The compress command uses the .Z file extension for compressed files. The gzip command uses the .gz file extension for compressed files. The zip command creates a zip archive with the specified file(s) and uses the .zip extension.
-gzip is more widely supported and used on various platforms. compress is less common today and may not be available by default on some systems. -gzip has additional features, such as the ability to compress multiple files into a single archive (tar can be used in conjunction with gzip for this purpose).
2-zcat example.txt.gz
3-tar -cvf ~/etc *
4-find ~/ -type f -mtime -2
5-sudo find /etc -type f -user root
6-find ~/ -type d
7- sudo find / -type f -name ".profile"
8- file /etc/passwd file /dev/pts/0 file /etc file /dev/sda
9- ls -i / ls -i /etc ls -i /etc/hosts
10-cp /etc/passwd ~/passwd_backup diff /etc/passwd ~/passwd_backup cmp /etc/passwd ~/passwd_backup
vi ~/passwd_backup diff /etc/passwd ~/passwd_backup cmp /etc/passwd ~/passwd_backup
11-sudo ln -s /etc/passwd /boot/passwd_link ls -l /boot
12- sudo ln /etc/passwd /boot/passwd_link the /boot directory is on a different partition, you'll likely encounter an error message indicating that hard links across file systems are not allowed.
#sed
1-sed 'lp/p' /etc/passwd
2-sed -e '3d' -e '1,$p' /etc/passwd
3-sed -e '$d' -e '1,$p' /etc/passwd
4-sed -e '/lp/d' -e '1,$p' /etc/passwd
5-sed 's/lp/mylp' /etc/passwd
#awk
1-awk -F: '{print $5}' /etc/passwd
2-awk -F: '{print $1,$5,$6}' /etc/passwd
3-awk -F: '{ if($3>500) print $1,$3,$5}' /etc/passwd
4-awk -F: '{ if($3==500) print $1,$3,$5}' /etc/passwd
5-awk -F: '{ if(NR>=5&&NR<=15) print NR,$0}' /etc/passwd
6-awk -F: '{for(i=1;i<=NF;i++) {if($i=="lp") $i="mylp"} print ;}' file1
7-awk -F: 'BEGIN {max=0} {if ($3>max) {max=$3; maxline=$0}} END{print maxline}' file1
8-awk -F: 'BEGIN {sum=0} {sum+=$3} END {print sum}' file1
sudo systemctl set-default multi-user.target
reboot .target