Essential Linux Commands and Quota Management
Classified in Computers
Written on in
English with a size of 4.68 KB
Here's a list of essential Linux commands:
lime- Displays the current calendar.lime 1980- Shows the calendar for the year 1980.cal 12 1980- Displays the calendar for December 1980.date- Displays the current date.date -s "2009-11-05 18:55"- Changes the system time.who- Shows who is currently logged into the system.who -u- Displays the process ID (PID) of logged-in users.kill -9 3525- Terminates the process with PID 3525.uname- Outputs the machine's name.uname -a- Shows detailed information about the machine.uptime- Displays how long the machine has been running.du- Displays disk space usage by folders.du -k- Displays disk space usage in 1024-byte blocks.df- Displays disk usage statistics.ps- Displays a general list of running processes.top- Displays a real-time view of the most resource-intensive processes.free- Shows memory availability and statistics.dmesg- Displays kernel messages.lsmod- Shows loaded kernel modules.lspci- Displays hardware components.man- Accesses the system's manual pages.whatis who- Shows a brief description of thewhocommand.whereis who- Shows the location of thewhocommand.
Vi Editor Tips:
- To quit and save changes: press
Esc, then type:xand pressEnter. - To quit without saving changes: press
Esc, then type:q!and pressEnter.
Partitioning and Formatting
fdisk -l- Lists existing partitions.mkfs.ext3 "path"- Formats a partition with the ext3 filesystem.fdisk /dev/hda- Opens the fdisk utility to create partitions on /dev/hda.
Partitioning Steps:
- Press
nfor new partition. - Choose the partition type (primary or extended).
- Specify the partition size (e.g.,
+1000Mfor 1000MB). - Press
wto write the changes to disk.
After partitioning:
partprobe- Informs the kernel about partition table changes.
Disk Quota Management
First, create users for comparison. It is assumed that you know how to create users.
To configure disk quotas:
- Mount to view the Linux File System.
- Edit
/etc/fstabusingnano. - Add the following lines (adjusting the path as needed):
LABEL=/home /home ext3 defaults 1 2LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2
- Remount the filesystem:
mount -o remount /home - Run
quotacheck -augmvto create, verify, or repair quota control files. Alternatively, usequotacheck ugmv /home. - Verify that the home file system supports quotas by checking for
aquota.userandaquota.groupfiles in the/homedirectory:cd /homefollowed byls -l. - Activate quota support:
quotaon -ugv /home - To disable disk quotas:
quotaoff -v /home
Now that the /home file system has quota support enabled, you can apply quotas to users and groups.
edquota -u user1- Grant quotas to user1.quota -u user1- Check the quota settings for user1.quota -s -u user1- View a report of quota usage for user1.edquota -t- Set the grace period (the time a user is allowed to exceed their quota) at the system level.edquota -u user1 -T- Set the grace period for user1.
To schedule quota warnings, edit /etc/crontab and add a line like:
0 0,12 * * * root /usr/sbin/warnquota
Other useful quota commands:
quotacheck: To check the file system and update the quota system explicitly.repquota -a: Show details of shares in a particular file system.quotaon / quotaoff: To enable/disable quota system in a given file system.