Linux Basics
0 FOLLOWERS
The best site for Linux Administration. Follow to get updates.
Linux Basics
3y ago
GROUPS:
Users are assigned to groups with unique group ID numbers (the GID)
The group name and GID are stored in /etc/group
Each user is given their own private group
They can also be added to their groups to gain additional access
All users in a group can share files that belong to the group.
Each user is a member of at least one group, called a primary group. In addition, a user can be a member of an unlimited number of secondary groups. Group membership can be used to control the files that a user can read and edit. For example, if two users are working on the same project you might put ..read more
Linux Basics
3y ago
In Linux/Unix user is one who uses the system. There can be at least one or more than one users in Linux at a time. Users on a system are identified by a username and a userid. The username is something that users would normally refer to, but as far as the operating system is concerned this is referred to using the user id (or uid). The username is typically a user friendly string, such as your name, whereas the user id is a number. The words username and userid are often (incorrectly) used interchangeably. The user id numbers should be unique (one number per user). If you had two usernames w ..read more
Linux Basics
3y ago
The Linux Logical Volume Manager (LVM) is a mechanism to virtualize the disks. It can create “virtual” disk partitions out of one or more physical hard drives, allowing you to grow, shrink, or move those partitions from drive to drive as your needs change. It also allows you to create larger partitions than you could achieve with a single drive. Traditional uses of LVM have included databases and company file servers, but even home users may want large partitions for music or video collections, or for storing online backups. LVM can also be convenient ways to gain redundancy without sacrifici ..read more
Linux Basics
3y ago
Creating a Physical Volume (PV):
Create a partition using fdisk, and change the hex code of it to
Save and exit the fdisk and update the partition table using fdisk /dev/sda command.
Create 3 Physical volumes from 3 physical disks (/dev/sda8, /dev/sda9, /dev/sda10).
[root@localhost ~]# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1050623 524288 83 Linux
/dev/sda2 1050624 42993663 20971520 83 Linux
/dev/sda3 42993664 84936703 20971520 83 Linux
/dev/sda4 84936704 209715199 6238924 ..read more
Linux Basics
3y ago
To view the existing partitions:
#fdisk –l or parted –l
[root@localhost ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00048379
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1050623 524288 83 Linux
/dev/sda2 1050624 42993663 20971520 83 Linux
/dev/sda3 42993664 84936703 20971520 83 Linux
/dev ..read more
Linux Basics
3y ago
What is a partition?
Partitioning is a means to divide a single hard drive into many logical drives. A partition is a contiguous set of blocks on a drive that is treated as an independent disk. A partition table is an index that relates sections of the hard drive to partitions.
Why have multiple partitions?
Encapsulate your data. Since file system corruption is local to a partition, you stand to lose only some of your data if an accident
Increase disk space efficiency. You can format partitions with varying block sizes, depending on your usage. If your data is in a large number of small files ..read more
Linux Basics
3y ago
Permissions are applied on three levels:-
Owner or User level
Group level
Others level
Access modes are of three types:-
r read only
w write/edit/delete/append
x execute/run a command
Access modes are different on file and directory:
Permissions
Files
Directory
R
Open the file
‘ls’ the contents of dir
W
Write, edit, append, delete file
Add/Del/Rename contents of dir
X
To run a command/shell script
To enter into dir using ‘cd’
[root@localhost ~]# ls -l lbfile -rw-r--r--. 1 root root 13 Apr 10 08:36 lbfile[root@localhost ~]# ls -ld lbdir
drwxr-xr ..read more
Linux Basics
3y ago
find command is used to find the files or directory’s path, it is exactly like the find option in windows where you can search for a file.
Syntax: find / (under root) –option filename
Options that can be used with find command:
Finding a File with name#find / -name linuxfile
[root@localhost ~]# find / -name linuxfile/root/linuxfile[root@localhost ~]#
Finding a file with its inode number
#find / -inum 3076
[root@localhost ~]# find / -inum 3076/root/linuxfile.hlink/root/linuxfile/sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:06/device:1a/path/sys/kernel/debug/tracing/events/power/pm_q ..read more
Linux Basics
3y ago
Filter commands are used to filter the output so that the required things can easily be picked up. The commands which are used to filter the output are
less
more
head
tail
sort
cut
sed
less:-
The less command is used to see the output line wise or page wise.
Ex: less /etc/passwd
[root@localhost ~]# root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8 ..read more
Linux Basics
3y ago
Regular Expressions, Pipelines & I/O Redirections Grep:Grep stands for Global Regular Expression Print. It is used to pick out the required expression from the file and print the output. If grep is combined with another command it can be used to pick out the selected word, phrase from the output of first command and print it.
Examples of Grep:Let us pick the information about root from the file /etc/passwd (/etc/passwd contains information about all the users present in the system)
#grep root /etc/passwd
[root@localhost ~]# grep root /etc/passwdroot:x:0:0:root:/root:/bin/bashoperator:x:1 ..read more