Work with files and folders
$stat FileOrDirectoryName = display permission details
$getfacl /path/to/file = display file permissions
$ls -alh /home/userName = list userName home folder permissions (all,long,human)
$chgrp -R userName groupName = change group ownership of a file or directory
$chown root:root fileName = change user:group ownership of a file
$sudo chmod 0750 /home/userName = change folder permission for everyone else to not have access to userName home folder
File permissions & Disk utilities
$chmod = to assign/remove permissions to a file
--- r w x T
---Owner: 4 2 1 7 = The first octet represents permissions for the owner
---Group: 0 0 0 0 = The second octet represents permissions for the group
---Other: 0 0 0 0 = The third octet represents permissions for everyone else
---Command: chmod 700 : +1 for execute permission.
Disk utilities
$sudo ncdu / = shows you disk utilization of / root directory and you can drill into subfolders as well
$sudo lsof | grep 'deleted' = shows files that were deleted from disk but are kept in memory (restart computer to reclaim that space or if you see apache2 log files that were deleted and still have links then just restart apache server) = lsof stand for 'list offline'
$sudo apt-get autoremove = frees up disk space by removing old dependences of libs and packages and kernels that were automatically installed by your system
$lsblk = list volumes and partitions size (see --help for more options)
$du -sh /Path/To/DirectoryName = disk utilization short & -human-summary
$lvextend -l +4607 /dev/edge01-vg/root = to extend the vg (volume group) with 4607 PE (blocks) = 18 GB.
Note: after you add a new disk device to your physical server you'll have to create a file system on that disk and to mount t o a point (folder)
1. $sudo file -s /dev/nvme?n* = check if you have a file system on every disk device nvme?n* and if you do, go to step 2, if not go to step 1.a.
a. $sudo mkfs.xfs /dev/nvme0n1 = make file system on new disk nvme0n1
2. $sudo blkid | grep volumeName = this will display the volume UUID (or $sudo lsblk -o +UUID)
3. $sudo nano /etc/fstab = (BACKUP YOUR fstab FIRST) add the following line in to the fstab file system so you always mount your new disk device at reboot
UUID=enterTheUUIDnumber_found_earlier /mountingFolder Ext4 Default,discard 0 2
4. $sudo mount -a = verify that your entry to fstab works. This command will mount all the file system in /etc/fstab. If there are no errors, your file system will mount automatically after it is rebooted.
5. $df -kh = verify your mounting points; check if /mountingFolder is mounted to your new disk
6. $sudo growpart /dev/volumeName partitionNumber = expands the partition to match the volume size (partition number is that dig it after letter 'p' nvme1n1p1)
7. $sudo $resize2fs /dev/LogicalPartitionName = extend the actual file-system in use to the max available space on the LogicalPartitionName
8. $sudo xfs_growfs /dev/nvme1n1 = if your partition type is xfs than use this command to expand partition file system instead resize2fs