0% found this document useful (0 votes)
5 views2 pages

Linux Last Moments

Uploaded by

personalr898
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Linux Last Moments

Uploaded by

personalr898
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. What is the difference between sudo and su?

sudo: Runs a single command with root privileges.


su: Switches the current user to root or another user entirely.

Example:
sudo apt update (run just this command as root)
su - (switch to root shell)

2. What is the difference between > and >>?


>: Overwrites the file.
>>: Appends to the file.
Example:
echo "Hello" > file.txt → replaces content
echo "World" >> file.txt → adds to existing conte

3. How do you copy, move, and delete files in Linux?


Copy: cp source.txt destination.txt
Move (or rename): mv oldname.txt newname.txt
Delete: rm file.txt

4. How can you find a specific file in Linux?


Use the find command:

bash
Copy
Edit
find /path -name filename

5. What does chmod do? Explain with examples.


Changes file permissions.
Syntax: chmod [permissions] file

Example:

chmod 755 script.sh → rwxr-xr-x


chmod +x script.sh → adds executable permission

6. What is the use of chown?


Changes ownership of a file or directory.
Syntax: chown [user]:[group] file

Example:
chown ubuntu:ubuntu data.txt

7. How do you check running processes?Use any of these:

ps aux
top (real-time)
htop (interactive, if installed)

8. How do you check the current IP address?


ip a
hostname -I
ifconfig (older systems)

9. What is the use of ping, netstat, ss, and curl?


ping: Tests network connectivity to a host.
netstat: Shows active ports and connections (older).
ss: Replacement for netstat (faster and modern).
curl: Fetches data from a URL via HTTP, FTP, etc.

10. How do you check which ports are listening?


ss -tuln
netstat -tuln (on older systems)

10. How do you check which ports are listening?


ss -tuln
netstat -tuln (on older systems)

13. How do you create and delete users?


Create: sudo adduser username
Delete: sudo deluser username

15. How do you start/stop services in Linux?


Use systemctl:
Start: sudo systemctl start nginx
Stop: sudo systemctl stop nginx
Restart: sudo systemctl restart nginx

6. What is systemd?
systemd is a system and service manager used to initialize the system, manage
services (daemons), and handle logs.
Replaces older init systems like SysV.
Manages services via systemctl.

You might also like