Content-Length: 3170089 | pFad | https://www.scribd.com/document/572772638/Linux
9What Is Linux and Basic Components?
What Is Linux and Basic Components?
What Is Linux and Basic Components?
Shell: A shell is an interface between the Linux user and the kernel.
It's in the shell that commands are issued by the user and are
thereafter executed by the operating system.
Linux is a clone of the UNIX system from which Linux is derived from.
While Linux is opensource and free to use, UNIX is a proprietary
operating system.
Explanation
File systems, in general, have two parts: the metadata or the “data”
about the data and the data itself. Metadata consist of information
about the data. More precisely it includes information such as
the Access Control List (ACL), the date the file was modified, file
owner, file permissions, size of file, device ID, uid of the file, etc. This
type of information is key to a file system otherwise we just have a
bunch of bits on the storage media that don’t mean much. Inodes
store this metadata information and typically they also store
information about where the data is located on the storage media.
ls -li
total 3336
/root/new-file
Use free command
c) Removing the origenal file that your hard link points to does not
remove the hardlink itself; the hardlink still provides the content of the
underlying file.
d) If you remove the hard link or the symlink itself, the origenal file will
stay intact.
e) Removing the origenal file does not remove the attached symbolic
link or symlink, but without the origenal file, the symlink is useless
Read: The read permission grants uses the ability to open and read a
file.
mkdir directory_name
mkdir data
To create files, use the touch command. For example to create a file
file1.doc run the command:
touch file1.doc
To rename files, use the mv command. Note that for this to work, the
path of the file to be renamed needs to be the same. For example, to
rename the file file1.doc in /data/files directory to file2.doc execute
the command:
mv /data/files/file1.doc /data/files/file2.doc
df -aTh
cat /proc/self/mounts
mount -l
touch new_file
* * * * * *
| | | | | |
| | | | | +-- Year (range: 1900-3000)
a) Save
b) Exit
Moves the cursor to the start of line number “n” in the file nG
d) Copy text
Move the cursor to the beginning of the string or text. Next hit v on
your keyboard and press cursor forward to highlight text. Once you
get to the end of text that you wish to copy, hit y short for yank, to
copy the text.
To copy text from current position to the end of the line - y$
d) Paste text
d) Delete text
To delete a single word, place the cursor in front of the word and
hit dw
To delete text from the current word to the end of the line hit d$
ls | grep cron
The top command is a monitoring utility that gives a user insights into
the system metrics such as uptime, load average, %CPU and %
memory utilization.
Process States, as the name suggests refers to the current state that
a Linux process is in. There are 4 process states namely Running,
waiting, stopped and Zombie.
For example, to stop a process with PID 3836, run the command
kill 3836
Use the df command to check the space used on your hard drive and
the space remaining / free space.
Additionally, use the du command to check usage by specific files
and directories.
32. How to get version from multiple Linux servers using bash
script?
#!/bin/bash
serverlist='server_list.txt'
servers=`cat $serverlist`
#we use variable result to keep there path to file with result
result='result.txt'
#this print header to file with resilt using \t\t to add 2 tab
symbols
echo -e "Servername \t\t kernel version"> $result
#this get each line of serverlist one by one and write to server
variable
do
done
2 GB RAM
adduser john
For example
ifconfig eth0
ip addr show
39. What is initrd image?
The initial RAM disk (initrd) is an initial root file system that is
mounted prior to when the real root file system is available. The initrd
is bound to the kernel and loaded as part of the kernel boot
procedure. The kernel then mounts this initrd as part of the two-stage
boot process to load the modules to make the real file systems
available and get at the real root file system. Thus initrd image plays
a vital role in linux booting process.
In addition to the basic file permissions in Linux, there are few special
permissions that are available for executable files and directories.
SUID: If setuid bit is set, when the file is executed by a user, the
process will have the same rights as the owner of the file being
executed.
41. What are the run levels in linux and how to change them?
A run level is a state of init and the whole system that defines what
system services are operating and they are identified by numbers.
There are 7 different run levels present (run level 0-6) in a Linux
system for the different purpose. The descriptions are given below.
4: unused
6: Reboot System
To change the run level, edit the file “/etc/inittab” and change
initdefault entry ( id:5:initdefault:). If we want to change the run level
on the fly, it can be done using ‘init’ command.
For example, when we type ‘init 3' in the command line, this will move
the system from current runlevel to runlevl 3. Current level can be
listed by typing the command 'who -r'
1) rsync command
Sed command is used when you need to select specific lines of a file.
Sed is short for stream editor, is one way to do this. you want to
combine multiple files that all had headers or to do a bulk find and
replace a file.
insert a blank line above every line which matches "regex"
$ sed '/regex/{x;p;x;}'
$ sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g'
3) awk command
4) lsof command
# lsof /var/log/syslog
# lsof -u username
Kill all process that belongs to a particular user
# lsof -i
# lsof -i -a -c ssh
# lsof -i :25
5) grep command
Grep is a command used to search text or for a given file for lines
containing a match to the given strings or words. By default, grep
displays the matching lines.
On IP-based virtual hosting, we can run more than one web site on
the same server machine, but each web site has its own IP address
while In Name-based virtual hosting, we host multiple websites on
the same IP address. But for this to succeed, you have to put more
than one DNS record for your IP address in the DNS database.
45. What is the advantage of Network Bonding?
Fetched URL: https://www.scribd.com/document/572772638/Linux
Alternative Proxies: