Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views11 pages

Linux Rev

Linux rev

Uploaded by

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

Linux Rev

Linux rev

Uploaded by

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

Ch 11

● IPv4 Configuration File: /etc/sysconfig/network-scripts/ifcfg-eth0


● To configure as DHCP, change BOOTPROTO value to dhcp.
● IPv6 Configuration File: /etc/sysconfig/network-scripts/ifcfg-eth0
IPV6INIT=yes
IPV6ADDR=<IPv6 IP Address>
IPV6_DEFAULTGW=<IPv6 IP Gateway Address>
● /etc/hosts - Contains a table of hostnames to IP addresses
● /etc/resolv.conf - Contains the IP addresses of the name servers the system
uses to resolve names to IP addresses
● /etc/nsswitch.conf - Used to modify where hostname lookups occur
● Ifconfig command stands for "interface configuration".
Used to display network configuration information
● The ip command is replacing the ifconfig command. ip command has
increased functionality and set of options.
● The route command can be used to view a table that describes where
network packages are sent.
● The ping command can be used to determine if another machine is
"reachable". -c option followed by a number to limit how many pings to
send.
● The netstat command is used to display information about network
connections as well as display the routing table similar to the route command
● The ss command is designed to show socket statistics
● dig command is used to determine the IP address.
● The host command works with DNS to associate a hostname with an IP
address.
● The ssh command will allow you to connect to another machine across the
network.
Ch10
● The cat command is a useful command that can be used
1- to create and
2- display text files,
3- as well as combining copies of text files.
4- also be used to redirect file content to other files or input to another
command by using redirection characters.

• There are two commonly used pager commands:


a. The less command provides advanced paging capability but is not
included with all Linux distributions.
b. The more command has fewer features than less, but is available in
Linux distributions.
• Spacebar -----Window forward
• B--- window Backward
• Enter --- line forward
• Q--- Exit
• H --- help
• N--- next match
• Shift + N --- previous match
• The head and tail commands are used to display only the first or last few
• lines of a file. -n ‫بحدد العدد‬
• The pipe | character can be used to send the output of one command to
another.
-Redirection

• STDIN: Standard input, or STDIN, is information entered normally by the user


via the keyboard. [> ]
• STDOUT: Standard output, or STDOUT, is the normal output of commands[<]
The single arrow overwrites any contents of an existing file[<].
The double arrow append to a file instead of overwriting it [<<].
• STDERR: Standard error, or STDERR, are error messages generated by
commands[2 <]
• [&>] STDOUT&STDERR
• sort command can be used to rearrange
• -t option will allow separator to be specified [:,/]
• -k field number ‫بحدد رقم الحقل‬
• -n a numeric sort
sysadmin@localhost:~$ sort -t: -n -k3 mypasswd

• The wc command provides the number of lines, words and bytes (1 byte = 1
character in a text file) for a file, and a total line count if more than one file
is specified.
• -l option to show just the number of lines
• -w option to show just the number of words
• -c option to show just the number of bytes
• cut command can extract columns of text from a file or standard input.
• -d option can specify alternative delimiters such as the colon [:,/].
• -f field number ‫بحدد رقم الحقل‬
• -c option is used to extract columns
sysadmin@localhost:~$ cut -d: -f1,5-7 mypasswd

• grep command can be used to filter lines in a file


• -d option can specify alternative delimiters such as the colon [:,/].
• -f field number ‫بحدد رقم الحقل‬
• -c option is used to extract columns

• . • Any single character

• [] • A list or range of characters

• * • The previous character repeated zero or more times

• ^ • If the first character

• $ • If the last character


Ch9
• Compression: Makes the files smaller by removing redundant information.
• Lossless: No information is removed from the file.
• Lossy: Information might be removed from the file
• gzip Compression commend(compressed version with a file extension of .gz )
• gzip -l: display this information (compressed - uncompressed-ratio)
• (decompression) using either the gunzip command or the gzip –d command.

• Archiving is when you compress many files or directories into one file.
• Create: Make a new archive out of a series of files.
• Creating an archive with the tar command
-c : Create an archive.
-f :the name of the resulting archive file.
-z or -j : compress file (tar -z)
• Extract: Pull one or more files out of an archive.
-x : Extract files from an archive.
-j: Decompress with the bzip2 command.
-f: Operate on the given archive.
• List: Show the contents of the archive without extracting.
-t : List the files in the archive.
-j: Decompress with the bzip2 command.
-f: Operate on the given archive.

● zip is to add files to an archive and compress it.


● unzip: decompress
ch8
• Linux is case sensitive
• The Asterisk *: to represent zero or more of any character in a filename.
• Question Mark ? : matches exactly one character
• Brackets [ ]: representing a range of characters
• Exclamation Point !: to negate a range. (‫)استثناء‬
• ls : display the contents of the directory and directory name(‫)االسم و المحتويات‬
• ls-d: to display just the name of directories ( ‫)األسم بس‬
• cp command is used to copy files
• The structure : cp [source] [destination]
• -v : show output if successful
• -i: ask yes(y) or no(n)
• -n : default no
• -r: copy both files and directories.
● mv command to move a file.
● If you don't have the right permissions, you will receive a "Permission
denied" error message.
● The mv command is not just used to move a file, but also to rename a file.
● The name of the file will change only if a destination file name is also
specified.
● If a destination directory is not specified, the file will be renamed using the
destination file name and remain in the source directory.

● -i: Interactive: Ask if a file is to be overwritten.


● -n : No Clobber: Do not overwrite a destination files' contents.
● -v : Verbose: Show the resulting move.
touch: create an empty file
mkdir: create directory
rm : to delete a file ( ‫عشان ما ينحذف شي بالغلط‬ i ‫)يفضل استخدام‬
rm-r: delete a directory
Ch7
● In Linux, everything is stored in files.
● Files are used to store data such as text, graphics, and programs.
● Directories are a type of file used to store other files.
● Directories are used to provide a hierarchical organization structure.
● Linux directory structure, called a filesystem
● Top level call root
● root directory ( ‫ يرمز لها‬by the slash / character).
● ls/: display name of the root directory
● directory called home under the root / directory.
● The home directory ) ‫(يشار له‬has a special symbol used to represent it,
the tilde ~ character.
● The directory name is the same as the name of the user.
● The pwd (print working directory) command: can be used to determine where
the user is currently located within the filesystem. ‫بطبع الموقع الحالي للمستخم‬
● cd (change directory) command: To navigate in filesystem ‫للتنقل عبر النظام‬
● cd : ‫بس لحالها راح توديني للهوم‬
● If the user tries to change to a directory that does not exist, the command
returns an error message
● A path is a list of directories separated)‫ (مفصول بينهم‬by the / character.

● There are two types of paths :


1- Absolute Paths : allow the user to specify the exact location of a directory.
Absolute paths always starts at the root directory, and therefore it always
begins with the / character.
Ex: /home/sysadmin
I can also use cd (change directory) ex: cd /home/sysadmin

2- Relative Paths: gives directions to a file relative to the current location in


the filesystem. ‫بعطي اتجاهات الملف بالنسبة للموقع الحالي‬
Relative paths start with the name of a directory
Ex: cd school/art

● cd.. (back one directory)


● cd../../ (use in longer path )
● cd.( always represents the current directory.)
● ls command is used to display the contents of a directory
● A hidden file is any file (or directory) that begins with a dot . character.
● ls-a : show all the file even hidden one .
● Each file has details associated with it called metadata, this can include
information such as the size, ownership, or timestamps.
● ls-l : to display metadata .
● File Type:
The first character of each line indicates the type of file
Ex: drwxr-x--- 2 root adm 4096 Mar 14 17:48 apache2
● The file types are:
d--- directory ---A file used to store other files.
(-)---regular file--Includes readable files, images files, binary files, and
l---symbolic link---Points to another file.
s---socket---Allows for communication between processes
p---pipe---Allows for communication between processes
b---block file---Used to communicate with hardware.
c---character file ---Used to communicate with hardware.
● drwxr-xr-x 1 sysadmain atmp 108150 Apr 11 21:58 bootstrap.log
● File Type
● Permissions:The next nine characters demonstrate the permissions of the file.
● Hard Link Count: This number indicates how many hard links point to this file.
● User Owner: Every file is owned by a user account.This is important because
the owner has the rights to set permissions on a file.
● Group Owner: Indicates which group owns this file, this is important because
any member of this group has a set of permissions on the file.
● File size: Size of files in bytes.
● Timestamp: Indicates when a file’s contents were last modified.
● File Name:The name of the file or directory.
● Ls-l : displays file sizes in bytes
● ls-lh: display file size in a human readable size, like megabytes or gigabytes.
● ls-d: display the current directory
● ls-l: display the contents of the directory
● ls-R: Recursive Listing
● ls-lS: To sort files by size, we can use the -S option (capital letter s).
● ls-lSh: display human-readable file sizes
● ls-tl: display based on the time they were modified
● ls -t --full-time :display modification time information (including hours,
minutes, seconds)
● ls -lrS: a reverse sort
ch6
● Man Pages: The developers of UNIX created help documents called man
pages (short for manual page).
● Def : Man pages provide a basic description of the purpose of the command,
as well as details regarding available options.
● the man command : display man pages
● to control Man pages use arrows , to exit from it used Key Q
● Man pages are broken into sections.
● Each section is designed to provide specific information about a command.
1- NAME: Provides the name of the command and a very brief description.
2- SYNOPSIS(‫) الملخص‬: Provides examples of how the command is executed.
3- DESCRIPTION: Provides a more detailed description of the command.
4- OPTIONS: Lists the options for the command as well as a description of
how they are used
5- FILES: Provides a more detailed description of the command.
6- AUTHOR: Provides the name of the person who created the man page and
(sometimes) how to contact the person.
7- REPORTING BUGS: Provides details on how to report problems with the
command.
8- COPYRIGHT: Lists the options for the command as well as a description of
how they are used
9- SEE ALSO: Provides you with an idea of where you can find additional
information. This often includes other commands that are related to this
command
● To organize all of these man pages, they are categorized by sections.
By default there are nine default sections of man pages:
1. General Commands
2. System Calls
3. Library Calls
4. Special Files
5. File Formats and Conventions
6. Games
7. Miscellaneous ‫متنوع‬
8. System Administration Commands
9. Kernel Routines
● The man command searches each of these sections in order until it finds the
first match. To search a man page for a term, press the / and type the term
followed by the Enter key.
● whereis :To search for the location of a command or the man pages for a
command, use the whereis command.
● Man pages are easily distinguished from commands as they are typically
compressed with a program called gzip, resulting in a filename that ends
in .gz.
،gzip ‫يمكن تمييز صفحات الدليل بسهولة عن األوامر حيث يتم ضغطها عادةً باستخدام برنامج يسمى‬
.gz. ‫مما يؤدي إلى اسم ملف ينتهي بـ‬
● locate command: To find any file or directory
● The -c option to the locate command will list how many files match:
Ex: sysadmin@localhost:~$ locate -c passwd
97
● Use the -b option to search only filenames and add a \ in front of the search
term
Ex: locate -b "\passwd"
● Man pages are excellent sources of information, but they do tend to have a
few disadvantages:
1-Each man page is a separate document, not related to any other man page.
2- Man pages may can be difficult to read.

● The info command : also provides documentation on operating system


commands and features.
1-Info documentation as a logical organizational structure, making reading
documentation easier.

2-Information is broken down into categories that work much like a table of
contents in a book.

● Consider man pages to be more of a reference resource and info documents


to be more of a learning guide.
.‫ ومستندات المعلومات لتكون بمثابة دليل تعليمي‬, ‫اعتبر صفحات الدليل بمثابة مصدر مرجعي‬
● A listing of movement commands is available by hitting the Shift+H key while
reading the info documentation.

l Close this help window.


q Quit Info altogether. ‫قم بإنهاء المعلومات تما ًما‬.
h Invoke the Info tutorial.
Up Move up one line.
Down Move down one line.
PgUp Scroll backward one screenful. ‫قم بالتمرير للخلف بمقدار شاشة واحدة‬.
PgDn Scroll forward one screenful. ‫قم بالتمرير لألمام بمقدار شاشة واحدة‬.
Home Go to the beginning of this node.
End Go to the end of this nod

To quit the info documentation, use the Q key.

● --help command : provide basic information


Ch5
● Once a user has entered a command the terminal then accepts what the user
has typed and passes to a shell.
● The CLI provides more precise control, greater speed and the ability to
automate tasks more easily through scripting.
‫( تحك ًما أكثر دقة وسرعة أكبر وقدرة على أتمتة المهام بسهولة أكبر‬CLI) ‫توفر واجهة سطر األوامر‬
.‫من خالل البرمجة النصية‬
● The shell is the command line interpreter that translates commands entered
by a user into actions to be performed by the operating system.
‫الصدفة هي مترجم سطر األوامر الذي يترجم األوامر التي يدخلها المستخدم إلى إجراءات ليتم تنفيذها بواسطة‬
.‫نظام التشغيل‬
● Bash shell: 1-Command line history 2- Inline editing 3-Scripting
● Aliases : The ability to create short nicknames for longer commands.
● Variables : Used to store information for the Bash shell and for the user.
● Current Directory (~)tilda
● A command is a software program that when executed on the CLI, performs
an action on the computer.
● This additional input comes in two forms: options and arguments.
1- Options: are used to modify the core behavior of a command.
Ex : la-l (additional information about the files)
2- Arguments: are used to provide additional information (such as a filename
or a username).) ‫بكون على شكل باث (مسار‬
Ex: la
● history command: To view the entire history list of a termina
● ‫اذا حطيت رقم مثال ثالثة برجع لي اخر ثالثة حركات عملتها‬
● 1-Local variables exist only in the current shell. When the user closes a
terminal window or shell, all of the variables are lost.
● Echo : print
● 2- Environment variables, also called global variables, are available system-
wide
● Ex: PATH, HOME, and HISTSIZE
● The export command is used to turn a local variable into an environment
variable.
Exported variables can be removed using the unset command
● The env command outputs a list of the environment variables.

You might also like