13,495 bytes added ,  14 March
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:


= System =
= System =
Line 15: Line 14:
| style="width: 50%;" | Detach a job from the current session
| style="width: 50%;" | Detach a job from the current session
| style="width: 50%;" class="cli" | sudo rsync templates/* whatever/ &<br>jobs<br>disown -h %1
| style="width: 50%;" class="cli" | sudo rsync templates/* whatever/ &<br>jobs<br>disown -h %1
|-
| style="width: 50%;" | Change the shape of the cursor
| style="width: 50%;" class="cli" |
echo -e -n "\x1b[\x30 q" # changes to blinking block<br>
echo -e -n "\x1b[\x31 q" # changes to blinking block also<br>
echo -e -n "\x1b[\x32 q" # changes to steady block<br>
echo -e -n "\x1b[\x33 q" # changes to blinking underline<br>
echo -e -n "\x1b[\x34 q" # changes to steady underline<br>
echo -e -n "\x1b[\x35 q" # changes to blinking bar<br>
echo -e -n "\x1b[\x36 q" # changes to steady bar
|}
|}


Line 63: Line 72:


* xargs - to be processed - [http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html Things you (probably) didn’t know about xargs]
* xargs - to be processed - [http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html Things you (probably) didn’t know about xargs]
Ignore "Permission denied" errors
<syntaxhighlight lang="bash">
$ find . 2>&1 | grep -si "sfrrgam"
</syntaxhighlight>


== LVM ==
== LVM ==
Line 133: Line 148:
| style="width: 50%;" class="cli" | vgrename vg02 my_volume_group
| style="width: 50%;" class="cli" | vgrename vg02 my_volume_group
|}
|}
=== Deleting volumes and then increasing the size of another volume ===
{{testedon|2020-10-21|RHEL 7.8}}
These commands remove volumes named ''laravelhome'' and ''laravelhtml'', and then increase ''lv_var'' volume with the remaining space.
<syntaxhighlight lang="console">
[root@it153coai01lnx ~]# lsblk
NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                    8:0    0  40G  0 disk
├─sda1                8:1    0  476M  0 part /boot
└─sda2                8:2    0 39.5G  0 part
  ├─vg00-swap        253:0    0  1.9G  0 lvm  [SWAP]
  ├─vg00-lv_root    253:1    0  9.3G  0 lvm  /
  ├─vg00-lv_tmp      253:2    0  1.9G  0 lvm  /tmp
  ├─vg00-lv_var      253:3    0  3.7G  0 lvm  /var
  ├─vg00-lv_varlog  253:4    0  3.7G  0 lvm  /var/log
  ├─vg00-lv_home    253:5    0    5G  0 lvm  /home
  └─vg00-laravelhome 253:6    0  19G  0 lvm
sdb                    8:16  0    5G  0 disk
└─vg00-laravelhome  253:6    0  19G  0 lvm
sdc                    8:32  0  35G  0 disk
└─vg00-laravelhtml  253:7    0  35G  0 lvm
sr0                  11:0    1 1024M  0 rom
[root@it153coai01lnx ~]# vgdisplay
  --- Volume group ---
  VG Name              vg00
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  12
  VG Access            read/write
  VG Status            resizable
  MAX LV                0
  Cur LV                8
  Open LV              6
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size              79.52 GiB
  PE Size              4.00 MiB
  Total PE              20358
  Alloc PE / Size      20358 / 79.52 GiB
  Free  PE / Size      0 / 0
  VG UUID              k3r0vo-ZcxE-3aQt-Bfjp-0KHf-zrbw-jD1oaA
[root@it153coai01lnx ~]# lvs
  LV          VG  Attr      LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  laravelhome vg00 -wi-a----- <19.04g
  laravelhtml vg00 -wi-a----- <35.00g
  lv_home    vg00 -wi-ao----  5.00g
  lv_root    vg00 -wi-ao----  9.31g
  lv_tmp      vg00 -wi-ao----  1.86g
  lv_var      vg00 -wi-ao----  <3.73g
  lv_varlog  vg00 -wi-ao----  <3.73g
  swap        vg00 -wi-ao----  1.86g
# remove entries from /etc/fstab
[root@it153coai01lnx ~]# vim /etc/fstab
[root@it153coai01lnx ~]# lvchange -an /dev/vg00/laravelhome
[root@it153coai01lnx ~]# lvchange -an /dev/vg00/laravelhtml
[root@it153coai01lnx ~]# lvremove /dev/vg00/laravelhome
  Logical volume "laravelhome" successfully removed
[root@it153coai01lnx ~]# lvremove /dev/vg00/laravelhtml
  Logical volume "laravelhtml" successfully removed
[root@it153coai01lnx ~]# lvs
  LV        VG  Attr      LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home  vg00 -wi-ao----  5.00g
  lv_root  vg00 -wi-ao----  9.31g
  lv_tmp    vg00 -wi-ao----  1.86g
  lv_var    vg00 -wi-ao---- <3.73g
  lv_varlog vg00 -wi-ao---- <3.73g
  swap      vg00 -wi-ao----  1.86g
[root@it153coai01lnx ~]# lvextend -L+2G /dev/vg00/lv_var
  Size of logical volume vg00/lv_var changed from <3.73 GiB (954 extents) to <5.73 GiB (1466 extents).
[root@it153coai01lnx ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    899M    0  899M  0% /dev
tmpfs                      910M  232K  910M  1% /dev/shm
tmpfs                      910M  98M  813M  11% /run
tmpfs                      910M    0  910M  0% /sys/fs/cgroup
/dev/mapper/vg00-lv_root    9.4G  6.0G  3.4G  65% /
/dev/sda1                  473M  181M  293M  39% /boot
/dev/mapper/vg00-lv_home    5.0G  1.2G  3.9G  23% /home
/dev/mapper/vg00-lv_tmp    1.9G  33M  1.9G  2% /tmp
/dev/mapper/vg00-lv_var    3.8G  3.7G  62M  99% /var
/dev/mapper/vg00-lv_varlog  3.8G  103M  3.7G  3% /var/log
tmpfs                      182M    0  182M  0% /run/user/4323
# for ext3 or ext4, it'd be: resize2fs /dev/vg00/lv_var; this is for an xfs fs
[root@it153coai01lnx ~]# xfs_growfs /dev/vg00/lv_var
meta-data=/dev/mapper/vg00-lv_var isize=256    agcount=4, agsize=244224 blks
        =                      sectsz=512  attr=2, projid32bit=1
        =                      crc=0        finobt=0 spinodes=0
data    =                      bsize=4096  blocks=976896, imaxpct=25
        =                      sunit=0      swidth=0 blks
naming  =version 2              bsize=4096  ascii-ci=0 ftype=0
log      =internal              bsize=4096  blocks=2560, version=2
        =                      sectsz=512  sunit=0 blks, lazy-count=1
realtime =none                  extsz=4096  blocks=0, rtextents=0
data blocks changed from 976896 to 1501184
[root@it153coai01lnx ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    899M    0  899M  0% /dev
tmpfs                      910M  232K  910M  1% /dev/shm
tmpfs                      910M  98M  813M  11% /run
tmpfs                      910M    0  910M  0% /sys/fs/cgroup
/dev/mapper/vg00-lv_root    9.4G  6.0G  3.4G  65% /
/dev/sda1                  473M  181M  293M  39% /boot
/dev/mapper/vg00-lv_home    5.0G  1.2G  3.9G  23% /home
/dev/mapper/vg00-lv_tmp    1.9G  33M  1.9G  2% /tmp
/dev/mapper/vg00-lv_var    5.8G  3.7G  2.1G  64% /var
/dev/mapper/vg00-lv_varlog  3.8G  103M  3.7G  3% /var/log
tmpfs                      182M    0  182M  0% /run/user/4323
</syntaxhighlight>
=== Adding a new disk to a LVM ===
{{testedon|2020-07-06|CentOS 8.1.1911}}
<syntaxhighlight lang="console">
[root@chara mhan]# lsblk
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                    8:0    0 238.5G  0 disk
└─sda1                  8:1    0 238.5G  0 part
  ├─centos_chara-root 253:0    0    2T  0 lvm  /
  └─centos_chara-home 253:2    0  200G  0 lvm  /home
sdb                    8:16  0 119.2G  0 disk
├─sdb1                  8:17  0  200M  0 part /boot/efi
├─sdb2                  8:18  0    1G  0 part /boot
└─sdb3                  8:19  0  118G  0 part
  ├─centos_chara-root 253:0    0    2T  0 lvm  /
  └─centos_chara-swap 253:1    0  7.9G  0 lvm  [SWAP]
sdc                    8:32  0  1.8T  0 disk
└─sdc1                  8:33  0  1.8T  0 part
  └─centos_chara-root 253:0    0    2T  0 lvm  /
sdd                    8:48  0 931.5G  0 disk
└─sdd1                  8:49  0 931.5G  0 part
sr0                    11:0    1  1024M  0 rom
[root@chara mhan]# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x8d7dc33f.
Command (m for help): n
Partition type
  p  primary (0 primary, 0 extended, 4 free)
  e  extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-1953525167, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525167, default 1953525167):
Created a new partition 1 of type 'Linux' and of size 931.5 GiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@chara mhan]# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created.
[root@chara mhan]# vgs
  VG          #PV #LV #SN Attr  VSize  VFree
  centos_chara  3  3  0 wz--n- <2.17t    0
[root@chara mhan]# vgextend centos_chara /dev/sdd1
  Volume group "centos_chara" successfully extended
[root@chara mhan]# lvdisplay | grep Path
  LV Path                /dev/centos_chara/swap
  LV Path                /dev/centos_chara/root
  LV Path                /dev/centos_chara/home
[root@chara mhan]# lvresize -l +100%free /dev/centos_chara/root
  Size of logical volume centos_chara/root changed from 1.96 TiB (514983 extents) to 2.87 TiB (753449 extents).
  Logical volume centos_chara/root successfully resized.
[root@chara mhan]# df -h | grep root
/dev/mapper/centos_chara-root  2.0T  1.9T  89G  96% /
[root@chara mhan]# grep root /etc/mtab
/dev/mapper/centos_chara-root / xfs rw,relatime,attr2,inode64,noquota 0 0
[root@chara mhan]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
devtmpfs                      7.8G    0  7.8G  0% /dev
tmpfs                          7.8G  176K  7.8G  1% /dev/shm
tmpfs                          7.8G  9.3M  7.8G  1% /run
tmpfs                          7.8G    0  7.8G  0% /sys/fs/cgroup
/dev/mapper/centos_chara-root  2.0T  1.9T  89G  96% /
/dev/sdb2                    1014M  293M  722M  29% /boot
/dev/mapper/centos_chara-home  200G  103G  98G  52% /home
/dev/sdb1                      200M  11M  190M  6% /boot/efi
tmpfs                          1.6G  4.0K  1.6G  1% /run/user/1000
[root@chara mhan]# xfs_growfs /
meta-data=/dev/mapper/centos_chara-root isize=512    agcount=161, agsize=3276800 blks
        =                      sectsz=512  attr=2, projid32bit=1
        =                      crc=1        finobt=0, sparse=0, rmapbt=0
        =                      reflink=0
data    =                      bsize=4096  blocks=527342592, imaxpct=25
        =                      sunit=0      swidth=0 blks
naming  =version 2              bsize=4096  ascii-ci=0, ftype=1
log      =internal log          bsize=4096  blocks=6400, version=2
        =                      sectsz=512  sunit=0 blks, lazy-count=1
realtime =none                  extsz=4096  blocks=0, rtextents=0
data blocks changed from 527342592 to 771531776
[root@chara mhan]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
devtmpfs                      7.8G    0  7.8G  0% /dev
tmpfs                          7.8G  176K  7.8G  1% /dev/shm
tmpfs                          7.8G  9.3M  7.8G  1% /run
tmpfs                          7.8G    0  7.8G  0% /sys/fs/cgroup
/dev/mapper/centos_chara-root  2.9T  1.9T 1020G  66% /
/dev/sdb2                    1014M  293M  722M  29% /boot
/dev/mapper/centos_chara-home  200G  103G  98G  52% /home
/dev/sdb1                      200M  11M  190M  6% /boot/efi
tmpfs                          1.6G  4.0K  1.6G  1% /run/user/1000
[root@chara mhan]#
</syntaxhighlight>
=== Separating out /srv to a dedicated LVM ===
{{testedon|2023-10-09|RHEL 8.8}}.  LoboCloud VM w/ 250 addl.
<syntaxhighlight lang="bash">
# pvcreate /dev/sdb
# vgcreate vgapps /dev/sdb
# lvcreate -n lv_www -L 100G vgapps
# mkfs.xfs /dev/mapper/vgapps-lv_www
# mount /dev/mapper/vgapps-lv_www /mnt
# mv -a /srv/* /mnt/
# vi /etc/fstab
/dev/mapper/vgapps-lv_www /srv xfs defaults 0 0
# umount /mnt
# mount /dev/mapper/vgapps-lv_www /srv
</syntaxhighlight>
To access the old /srv folder
<syntaxhighlight lang="bash">
# mount -o bind / /mnt
</syntaxhighlight>
=== Links ===
* [https://www.thegeekdiary.com/centos-rhel-how-to-find-logical-volumes-lvs-that-are-part-of-a-physical-volume-pv-in-lvm/ How to find Logical volumes (LVs) contained in Physical Volume (PVs) in LVM]


= Users =
= Users =
Line 197: Line 462:
List all audio cards you have:
List all audio cards you have:


<source lang="bash">
<syntaxhighlight lang="bash">
$ cat /proc/asound/cards
$ cat /proc/asound/cards
  0 [PCH            ]: HDA-Intel - HDA Intel PCH                                                                                                                 
  0 [PCH            ]: HDA-Intel - HDA Intel PCH                                                                                                                 
Line 205: Line 470:
  2 [SoundBar      ]: USB-Audio - Dell AC511 USB SoundBar                                                                                                       
  2 [SoundBar      ]: USB-Audio - Dell AC511 USB SoundBar                                                                                                       
                       Dell Dell AC511 USB SoundBar at usb-0000:00:14.0-4, full speed
                       Dell Dell AC511 USB SoundBar at usb-0000:00:14.0-4, full speed
</source>
</syntaxhighlight>


Get ALSA identifiers of those:
Get ALSA identifiers of those:


<source lang="bash">
<syntaxhighlight lang="bash">
$ aplay -l | awk -F \: '/,/{print $2}' | awk '{print $1}' | uniq                                                                                 
$ aplay -l | awk -F \: '/,/{print $2}' | awk '{print $1}' | uniq                                                                                 
PCH                                                                                                                                                             
PCH                                                                                                                                                             
NVidia                                                                                                                                                         
NVidia                                                                                                                                                         
SoundBar
SoundBar
</source>
</syntaxhighlight>


Update /etc/asound.conf:
Update /etc/asound.conf:


<source lang="ini">
<syntaxhighlight lang="ini">
pcm.!default {
pcm.!default {
         type hw
         type hw
Line 228: Line 493:
         card SoundBar
         card SoundBar
}
}
</source>
</syntaxhighlight>


I found that the numeric identifier for these cards and change on reboot.  That may be related to how the hardware detection works on Linux, and the order changes time to time.  So I've used the string identifier instead -- seems to stick better than a numeric value.
I found that the numeric identifier for these cards and change on reboot.  That may be related to how the hardware detection works on Linux, and the order changes time to time.  So I've used the string identifier instead -- seems to stick better than a numeric value.
Line 237: Line 502:
Restart pulseaudio. Do not sudo for this.
Restart pulseaudio. Do not sudo for this.


<source lang="console">
<syntaxhighlight lang="console">
$ pulseaudio -k && pulseaudio -D
$ pulseaudio -k && pulseaudio -D
</source>
</syntaxhighlight>


List sinks.
List sinks.


<source lang="console">
<syntaxhighlight lang="console">
$ pacmd list-sinks
$ pacmd list-sinks
1 sink(s) available.
1 sink(s) available.
Line 310: Line 575:


         active port: <analog-output>
         active port: <analog-output>
</source>
</syntaxhighlight>




Line 324: Line 589:
| Scan a network for connected computers  
| Scan a network for connected computers  
| class="cli" | $ sudo nmap -sP 129.24.22.0/24
| class="cli" | $ sudo nmap -sP 129.24.22.0/24
|
|-
| Check for an open port
| class="cli" | $ nc -zv 192.168.86.108 1523<br/>$ cat < /dev/tcp/host.server.com/22
|
|
|}
|}
Line 350: Line 619:
| {{testedon|2020-04-21|CentOS 7.7.1908}}
| {{testedon|2020-04-21|CentOS 7.7.1908}}
|}
|}
= Package management =
== Transaction check errors ==
{{testedon|2020-10-21|RHEL 7.8}}
<syntaxhighlight lang="console">
# running a yum update yields the following
  file /etc/os-release from install of redhat-release-server-7.9-3.el7.x86_64 conflicts with file from package oraclelinux-release-7:7.8-1.0.7.el7.x86_64
  file /etc/redhat-release from install of redhat-release-server-7.9-3.el7.x86_64 conflicts with file from package oraclelinux-release-7:7.8-1.0.7.el7.x86_64
  file /etc/rpm/macros.dist from install of redhat-release-server-7.9-3.el7.x86_64 conflicts with file from package oraclelinux-release-7:7.8-1.0.7.el7.x86_64
  file /etc/system-release from install of redhat-release-server-7.9-3.el7.x86_64 conflicts with file from package oraclelinux-release-7:7.8-1.0.7.el7.x86_64
  file /etc/system-release-cpe from install of redhat-release-server-7.9-3.el7.x86_64 conflicts with file from package oraclelinux-release-7:7.8-1.0.7.el7.x86_64
$ sudo yum install --downloadonly redhat-release-server
$ sudo find /var/cache/yum -type f -name "redhat-release-server*" -exec rpm -Uvh --force {} \;
$ sudo yum --disablerepo="*" --enablerepo="rhel*" --disablerepo="oraclelinux*" --disablerepo="rhel-source*" --disablerepo="rhel-beta*" update -y && sudo yum -y upgrade && sudo yum -y autoremove
</syntaxhighlight>


= Security =
= Security =
Line 355: Line 644:
* [[GnuPG]] - GNU's implementation of PGP, aka GPG
* [[GnuPG]] - GNU's implementation of PGP, aka GPG
* [[EncFS]] - encrypt files and folders
* [[EncFS]] - encrypt files and folders


= Links =
= Links =
Line 367: Line 655:
* [[i3wm]] - i3 window manager
* [[i3wm]] - i3 window manager
* [[Running Steam on CentOS 7 with NVIDIA driver]]
* [[Running Steam on CentOS 7 with NVIDIA driver]]
*History
**[https://upload.wikimedia.org/wikipedia/commons/c/cd/Unix_timeline.en.svg UNIX timeline]
**[https://upload.wikimedia.org/wikipedia/commons/8/8c/Linux_Distribution_Timeline_Dec._2020.svg Linux distributions timeline]