Report writing for fundamental of computing (week 10)
Fundamental of Computing DO3
On 10th week I learned about fundamental commands in Linux, basic file operations, and an introduction to the Linux file system. I also learned more advanced commands, such as those for process management, system monitoring, and package management. The explanation of the "ls -al" command and examples for interpreting its output are also taught by our lecturer. Additionally, the content briefly touched on text editors like VI or VIM, Nano, and gedit. In the second section we discussed the Linux file system, highlighting the directory tree, pathname, and different types of files in Linux, including regular files, directories, special files, sockets, pipes, and links. And to know more , some examples are shown to illustrate practical usage scenarios for these commands and concepts
Basic Command in Linux
The command given below are used in Linux;
·
ls: Lists the contents of a
directory.
·
cd: Changes the current working
directory.
·
pwd: Prints the current working
directory.
·
mkdir: Creates a new directory.
·
rmdir: Removes a directory.
·
rm: Removes a file.
·
cp: Copies a file or directory.
·
mv: Moves or renames a file or
directory.
·
touch: Creates a new empty file.
·
file: Checks the type of a file.
·
grep: Searches for a pattern in a
file.
·
cat: Concatenates files and prints
them to the standard output.
·
more: Displays a file one page at a
time.
·
less: Displays a file one page at a
time, but allows you to scroll back and forth.
·
diff: Compares two files and shows
the differences.
·
man: Displays the manual page for a
command.
Here are some more advanced Linux commands:
·
ps: Lists the currently running
processes.
·
kill: Kills a process.
·
top: Displays a real-time view of
the system's processes and resources.
·
sudo: Allows you to run commands as
another user, typically the root user.
·
apt-get: Installs and removes
software packages on Debian-based systems.
·
yum: Installs and removes software
packages on Red Hat-based systems.
·
tar: Creates and extracts archive
files.
·
gzip: Compresses files.
·
unzip: Decompresses files.
·
ssh: Connects to a remote computer
securely.
·
scp: Copies files between two
computers securely.
·
ftp: Transfers files between two
computers using the File Transfer Protocol.
Ls –R : shows all the files not only in
directories but also subdirectories
Ls –al : This command lists the contents of the
current directory in a long format, which includes additional information about
the files and directories, such as their permissions, owner, group, size, and
last modified date.
The columns in the output of the ls -al command
are as follows:
File type and access permissions: The file type (ordinary file, directory, symbolic link, etc.) and access permissions are shown in this column. Three characters are used to represent the different access rights: these reflect the permissions for the owner, group, and world, respectively.
# of HardLinks to the File: This column
shows the number of hard links to the file. A hard link is a direct
pointer to the file's data on the disk.
Owner and the creator of the file: This
column shows the name of the user who owns the file and the name of the group
to which the file belongs.
Group of the owner: This column shows the
name of the group to which the file belongs.
File size in Bytes: This column shows the
size of the file in bytes.
Date and Time: This column shows the date
and time when the file was last modified.
Directory or File name: This column shows
the name of the file or directory.
Here is an example of how to interpret the output
of the ls -al command:
- first example
total 12
drwxr-xr-x 2 user user 4096 Nov 2 08:42 .
drwxr-xr-x: This indicates that it is a directory (d), and the permissions for the owner, group, and others are set to read (r), write (w), and execute (x).
"2": The number of hard links to the directory.
user user: The owner and group of the directory.
4096: The size of the directory in bytes.
Nov 2 08:42: The last modification time of the directory.
- second example
drwxr-xr-x 4 user user 4096 Nov 2 08:42
..
drwxr-xr-x: This indicates that it is a directory (d), and the permissions for the owner, group, and others are set to read (r), write (w), and execute (x).
"4": The number of hard links to the directory. In the case of .., this typically represents the number of subdirectories and the parent directory itself.
"user user": The owner and group of the directory.
"4096": The size of the directory in bytes. For directories, this value represents the amount of disk space used by the directory's metadata, not the size of its contents.
"Nov 2 08:42": The last modification time of the directory.
"..": The name of the directory. In a directory listing, ".." refers to the parent directory
- third example
-rw-r--r-- 1 user user 1024 Nov 2 08:42
example.txt
"-rw-r--r--": This indicates that it is a regular file (-), and the permissions for the owner, group, and others are set to read (r) and write (w) for the owner, and read (r) for the group and others.
"1": The number of hard links to the file.
"user user": The owner and group of the file.
"1024": The size of the file in bytes.
"Nov 2 08:42": The last modification time of the file.
"example.txt": The name of the file.
The ls -al command is a very useful tool for
getting information about the files and
directories in your Linux system. You can use it to see what files are in a
directory, to check the permissions on a file, to see when a file was last
modified, and more.
Ls –a :command to view hidden files
How to create folder
To create directory inside other directory use
mkdir /other directory name/new Directory
rmdir: removes an empty directory.
grep (global regular expression
print) :Used to search text in files and print that matches the
given pattern.
History : Shows all the commands used in the past
for the current terminal sessions.
clear : Clears all the clutter on the terminal.
Refreshes the terminal display, removing previous content.
Text Editor
VI or VIM is a text editor designed for the
terminal, suitable for creating various file types. You can initiate it using
the <vi> or <vim> commands.
Nano is a different text editor that is now accessible for investigation. The integrated gedit programme is a graphical user interface (GUI) text editor that you may use if you'd rather. Just use the <gedit> command to launch it. The command <gedit file_name> can be used to open a particular file in gedit.
Fundamental of
Computing EO1
Linux file system is a builtin layer used to
handle the data management of the storage.
The Linux file system has a directory tree that
manages the file name, file size, creation date and much more information about
a file.
Linux Directory Structure - Tech Fry
Pathname: text string made up of one or more
names separated by forward slashes(/) used to find something in the
hierarchical file system tree.
Files are organized within a single tree
hierarchical file system structure made up of files containing data and
directories.
File Types in Linux
In Linux system, everything is a file and if it
is not a file it is a process and are of seven types.
1. Regular Files: These are the most common files
in Linux, storing data like text or program code, and are meant for
user-readable content.
2. Directories: Used to organize and store files
and other directories, helping maintain a structured file system.
3. Character Device Files (special files):
include character and block devices, representing hardware components like
keyboards (character) and hard drives (block). They allow interaction with
hardware.
4. Block device files (special files): represent
storage hardware like hard drives and SSDs, handling data in fixed-size blocks.
5. Local Domain Sockets: Serve as communication
endpoints for inter-process communication (IPC), enabling data exchange between
processes on the same system or over a network.
6. Named Pipes (FIFOs): Facilitate communication
between processes through a first-in, first-out mechanism, typically on the
same system.
7. Link Files: Act as shortcuts to other files or
directories, providing an alternative or simplified access path.
There are two types:
1. Hard Link: creates a mirror copy of the
original file.
2. Symbolic or Soft Link: contains a
reference to another file or directory by its pathname
Comments
Post a Comment