Lab 2
Lab 2
Helloo
This is a file created using nano
Ctrl+s (save)
Ctrl+x (exit)
2. mv pp1/dd.txt newdir
(dd.txt is a file present in pp1 directory, newdir is another directory) dd.txt is
moved to newdir.
3. The chmod command in Unix is used to change the file mode (permissions)
of files and directories. This command allows you to control who can read,
write, or execute a file, thereby managing access permissions for users and
groups.
File permissions are typically represented in three categories:
Owner: The user who owns the file.
Group: A group of users who have specific permissions on the file.
Others: All other users.
Each category can have three types of permissions:
Read (r): Permission to read the file.
Write (w): Permission to modify the file.
Execute (x): Permission to execute the file (if it is a program or script).
Numeric Mode:
Permissions can be set using a numeric (octal) representation:
0: No permission
1: Execute (x)
2: Write (w)
3: Write and execute (wx)
4: Read (r)
5: Read and execute (rx)
6: Read and write (rw)
7: Read, write, and execute (rwx)
you can also use symbolic notation to set permissions:
u: User (owner)
g: Group
o: Others
a: All (user, group, others)
+: Adds permission
-: Removes permission
=: Sets exact permission
To give the owner full permissions (read, write, execute), the group read and
execute permissions, and others no permissions:
PROCESS COMMANDS:
The ps (process status) command in Unix and Linux is used to display
information about the currently running processes. This command provides
details about processes such as their process IDs (PIDs), the users who own
them, and the commands that started them.
os40@redhat-OptiPlex-3060:~$ ps
PID TTY TIME CMD
13657 pts/31 00:00:00 bash
13872 pts/31 00:00:00 ps
PID (13657): This is the unique identifier for the first process.
TTY (pts/31): (Terminal type). This indicates that the process is running on
pseudo-terminal 31.
Pseudo-terminals (pts) are used for remote terminal sessions, such as SSH
connections.
TIME (00:00:00): This indicates that the process has used 0 seconds of
CPU time so far. This is common for processes that are mostly idle or have
just started.
CMD (bash): This is the command that started the process, which in this
case is bash. Bash is a Unix shell and command language.
CMD (ps): This is the command that started the process, which in this
case is ps. The ps command is used to display information about active
processes.
OPTIONS: