Author | Karel Zak |
Contributor(s) | Ruediger Meier, |
Sami Kerola, | |
Stanislav Brabec (all…) | |
Released | 2007 |
Source | util-linux.git |
Info |
---|
The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among others, Util-linux contains the fdisk configuration tool and the login program.
name | RPM | DEB | ARCH |
---|---|---|---|
utils-linux | + | + | + |
№ | Name | RPM | DEB | ARCH |
---|---|---|---|---|
1 | ld-linux-x86-64 | + | + | |
2 | libaudit | + | ||
3 | libblkid | + | + | |
4 | libcap-ng | + | ||
5 | libcrypt | + | + | |
6 | libc | + | + | |
7 | libfdisk | + | + | |
8 | libmount | + | + | |
9 | libm | + | + | |
10 | libncursesw | + | + | |
11 | libpam_misc | + | + | |
12 | libpam | + | + | |
13 | librt | + | + | |
14 | libselinux | + | + | |
15 | libsmartcols | + | + | |
16 | libsystemd | + | + | |
17 | libtinfo | + | + | |
18 | libudev | + | + | |
19 | libutempter | + | ||
20 | libutil | + | ||
21 | libuuid | + | + | |
22 | libz | + | + |
| CMD | MAN | DESCRIPTION |
| cal | (1) | display a calendar |
| cal | (1p) | print a calendar |
| chrt | (1) | manipulate the real-time attributes of a process |
| col | (1) | filter reverse line feeds from input |
| colcrt | (1) | filter nroff output for CRT previewing |
| colrm | (1) | remove columns from a file |
| column | (1) | columnate lists |
| dmesg | (1) | print or control the kernel ring buffer |
| eject | (1) | eject removable media |
| fallocate | (1) | preallocate or deallocate space to a file |
| fallocate | (2) | manipulate file space |
| findmnt | (8) | find a filesystem |
| flock | (1) | manage locks from shell scripts |
| flock | (2) | apply or remove an advisory lock on an open file |
| getopt | (3) | Parse command-line options |
| getopt | (1) | parse command options (enhanced) |
| getopt | (3p) | command option parsing |
| hexdump | (1) | display file contents in hexadecimal, decimal, octal, ... |
| i386 | (8) | change reported architecture in new program environmen... |
| ionice | (1) | set or get process I/O scheduling class and priority |
| ipcmk | (1) | make various IPC resources |
| ipcrm | (1) | remove certain IPC resources |
| ipcrm | (1p) | remove an XSI message queue, semaphore set, or shared ... |
| ipcs | (1) | show information on IPC facilities |
| ipcs | (1p) | report XSI interprocess communication facilities status |
| isosize | (8) | output the length of an iso9660 filesystem |
| kill | (1) | terminate a process |
| kill | (2) | send signal to a process |
| kill | (3p) | send a signal to a process or a group of processes |
| kill | (1p) | terminate or signal processes |
| last | (1) | show a listing of last logged in users |
| lastb | (1) | show a listing of last logged in users |
| linux32 | (8) | change reported architecture in new program environmen... |
| linux64 | (8) | change reported architecture in new program environmen... |
| logger | (1) | enter messages into the system log |
| logger | (1p) | log messages |
| login | (3) | write utmp and wtmp entries |
| login | (1) | begin session on the system |
| look | (1) | display lines beginning with a given string |
| lsblk | (8) | list block devices |
| lscpu | (1) | display information about the CPU architecture |
| lsipc | (1) | show information on IPC facilities currently employed ... |
| lslocks | (8) | list local system locks |
| lslogins | (1) | display information about known users in the system |
| lsns | (8) | list namespaces |
| mcookie | (1) | generate magic cookies for xauth |
| mesg | (1) | display (or do not display) messages from other users |
| mesg | (1p) | permit or deny messages |
| more | (1) | file perusal filter for crt viewing |
| more | (1p) | display files on a page-by-page basis |
| mount | (8) | mount a filesystem |
| mount | (2) | mount filesystem |
| mountpoint | (1) | see if a directory or file is a mountpoint |
| namei | (1) | follow a pathname until a terminal point is found |
| nsenter | (1) | run program with namespaces of other processes |
| vlimit | (3) | get/set resource limits |
| prlimit | (1) | get and set process resource limits |
| prlimit | (2) | get/set resource limits |
| raw | (8) | bind a Linux raw character device |
| raw | (3x) | curses input options |
| raw | (7) | Linux IPv4 raw sockets |
| rename | (1) | rename files |
| rename | (2) | change the name or location of a file |
| rename | (3p) | rename file relative to directory file descriptor |
| rename | (n) | Rename or delete a command |
| renice | (1) | alter priority of running processes |
| renice | (1p) | set nice values of running processes |
| rev | (1) | reverse lines characterwise |
| script | (1) | make typescript of terminal session |
| scriptreplay | (1) | play back typescripts, using timing information |
| setarch | (8) | change reported architecture in new program environmen... |
| setpriv | (1) | run a program with different Linux privilege settings |
| setsid | (1) | run a program in a new session |
| setsid | (2) | creates a session and sets the process group ID |
| setsid | (3p) | create session and set process group ID |
| setterm | (3x) | curses interfaces to terminfo database |
| setterm | (1) | set terminal attributes |
| su | (1) | run a command with substitute user and group ID |
| tailf | (1) | follow the growth of a log file |
| taskset | (1) | set or retrieve a process's CPU affinity |
| ul | (1) | do underlining |
| umount | (8) | unmount file systems |
| umount | (2) | unmount filesystem |
| uname26 | (8) | change reported architecture in new program environmen... |
| unshare | (1) | run program with some namespaces unshared from parent |
| unshare | (2) | disassociate parts of the process execution context |
| utmpdump | (1) | dump UTMP and WTMP files in raw format |
| uuidgen | (1) | create a new UUID value |
| wall | (1) | write a message to all users |
| wdctl | (8) | show hardware watchdog status |
| whereis | (1) | locate the binary, source, and manual page files for a... |
| write | (1) | send a message to another user |
| write | (2) | write to a file descriptor |
| write | (3p) | write on a file |
| write | (1p) | write to another user |
| x86_64 | (8) | change reported architecture in new program environmen... |
| addpart | (8) | tell the kernel about the existence of a partition |
| agetty | (8) | alternative Linux getty |
| blkdiscard | (8) | discard sectors on a device |
| blkid | (8) | locate/print block device attributes |
| blockdev | (8) | call block device ioctls from the command line |
| cfdisk | (8) | display or manipulate a disk partition table |
| chcpu | (8) | configure CPUs |
| clock | (8) | read or set the hardware clock (RTC) |
| clock | (3) | determine processor time |
| clock | (3p) | report CPU time used |
| clock | (n) | Obtain and manipulate dates and times |
| ctrlaltdel | (8) | set the function of the Ctrl-Alt-Del combination |
| delpart | (8) | tell the kernel to forget about a partition |
| fdformat | (8) | low-level format a floppy disk |
| fdisk | (8) | manipulate disk partition table |
| findfs | (8) | find a filesystem by label or UUID |
| fsck | (8) | check and repair a Linux filesystem |
| fsck.cramfs | (8) | fsck compressed ROM file system |
| fsck.minix | (8) | check consistency of Minix filesystem |
| fsfreeze | (8) | suspend access to a filesystem (Ext3/4, ReiserFS, JFS,... |
| fstrim | (8) | discard unused blocks on a mounted filesystem |
| hwclock | (8) | read or set the hardware clock (RTC) |
| ldattach | (8) | attach a line discipline to a serial line |
| losetup | (8) | set up and control loop devices |
| mkfs | (8) | build a Linux filesystem |
| mkfs.cramfs | (8) | make compressed ROM file system |
| mkfs.minix | (8) | make a Minix filesystem |
| mkswap | (8) | set up a Linux swap area |
| nologin | (8) | politely refuse a login |
| nologin | (5) | prevent unprivileged users from logging into the system |
| partx | (8) | tell the kernel about the presence and numbering of on... |
| pivot_root | (8) | change the root filesystem |
| pivot_root | (2) | change the root filesystem |
| readprofile | (8) | read kernel profiling information |
| resizepart | (8) | tell the kernel about the new size of a partition |
| rtcwake | (8) | enter a system sleep state until specified wakeup time |
| runuser | (1) | run a command with substitute user and group ID |
| sfdisk | (8) | display or manipulate a disk partition table |
| sulogin | (8) | single-user login |
| swaplabel | (8) | print or change the label or UUID of a swap area |
| swapoff | (8) | enable/disable devices and files for paging and swapping |
| swapoff | (2) | start/stop swapping to file/device |
| swapon | (8) | enable/disable devices and files for paging and swapping |
| swapon | (2) | start/stop swapping to file/device |
| switch_root | (8) | switch to another filesystem as the root of the mount ... |
| wipefs | (8) | wipe a signature from a device |
| zramctl | (8) | set up and control zram devices |
⬆ columnate lists
The column command appeared in 4.3BSD-Reno
OPT | ++V. | –V | DESC |
---|---|---|---|
-c, --columns | 2.13 | 2.30 | width of output in number of character |
-s, --separator | 2.19 | possible table delimiters | |
-t, --table | 2.19 | format a table output | |
-x, --fillrows | 2.19 | fill rows before columns | |
-e, --table-header-repeat | 2.30 | repeat header for each page | |
-E, --table-noextreme | 2.30 | don’t count long text from the columns to column widt | |
-N, --table-columns | 2.30 | comma separated columns names | |
-n, --talbe-name | 2.30 | table name for JSON output | |
-o, --output-separator | 2.30 | columns separator for table output | |
-O, --table-order | 2.30 | specify order of output columns | |
-c, --output-width | 2.30 | width of output in number of character | |
-H, --table-hide | 2.30 | don’t print the columns | |
-i, --tree-id | 2.30 | line ID to specify child-parent relation | |
-J, --json | 2.30 | use JSON output format for table | |
-p, --tree-parent | 2.30 | parent to specify child-parent relation | |
-R, --table-right | 2.30 | right align text in these columns | |
-T, --table-truncate | 2.30 | truncate text in the columns when necessary |
Nicely formated /etc/fstab
:
~$ sed 's/#.*//' /etc/fstab | column -t ~$ grep -v '#' /etc/fstab | column -t
pstree-like output, using libsmartcols
from util-linux v2.30:
~$ ps -h -o pid,ppid,comm | column --table --tree 3 --tree-id 1 --tree-parent 2 --table-hide 2 --table-right 1
findmnt
-like output from util-linux v2.30:
column /proc/self/mountinfo \
--table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \
--table-hide=SEP,ID,PARENT,ROOT,PROP,FS-OPTS,MAJMIN \
--table-order TARGET,SOURCE,TYPE,VFS-OPTS \
--tree TARGET \
--tree-id ID \
--tree-parent PARENT
Print /etc/passwd
in JSON format from util-linux v2.30:
grep -v nologin /etc/passwd | \
column --separator : --table --table-name passwd --json \
--table-columns USERNAME,PWD,UID,GID,GECOS,HOME,SHELL \
--table-hide PWD
colrm(1), ls(1), paste(1), sort(1)
⬆ manage locks from shell scripts Written by H. Peter Anvin
To protect against multiple run of the script
~$ flock -n /tmp/lock.txt -c "./script.sh"
⬆ display file contents in hexadecimal, decimal, octal, or ascii
OPT | TYPE | ++V | –V | DESC |
---|---|---|---|---|
display a hex dump of a file:
~$ hexdump -C -v input_file
⬆ list block devices Written by Milan Broz, Karel Zak
OPT | ++V | –V | DESC |
---|---|---|---|
-a, --all | print all devices | ||
-b, --bytes | print SIZE in bytes rather than in human readable format | ||
-d, --nodeps | don’t print slaves or holders | ||
-D, --discard | print discard capabilities | ||
-z, --zoned | print zone model | ||
-e, --exclude <list> | exclude devices by major number (default: RAM disks) | ||
-f, --fs | output info about filesystems | ||
-i, --ascii | use ascii characters only | ||
-I, --include <list> | show only devices with specified major numbers | ||
-J, --json | use JSON output format | ||
-l, --list | use list format output | ||
-m, --perms | output info about permissions | ||
-n, --noheadings | don’t print headings | ||
-o, --output <list> | output columns | ||
-O, --output-all | output all columns | ||
-p, --paths | print complete device path | ||
-P, --pairs | use key=”value” output format | ||
-r, --raw | use raw output format | ||
-s, --inverse | inverse dependencies | ||
-S, --scsi | output info about SCSI devices | ||
-t, --topology | output info about topology | ||
-x, --sort <column> | sort output by <column> |
output main devises sorted by size (sizes pathes):
~$ lsblk -ldnbp | awk '{print $1" ",$2}' | sort -rk1
⬆ mount a filesystem Written by Karel Zak
A mount command existed in Version 5 AT&T UNIX
OPT | FROM V. | END V. | DESC |
---|---|---|---|
-a, --all | Mount all from /etc/fstab/ | ||
-B | |||
-l | |||
-o | |||
-o loop | |||
-t |
Nicely printed mount table:
~$ mount | column -t
Mount ISO image to the system:
#!/usr/bin/env bash
ISO_PATH="$HOME/Downloads/Fedora-Workstation-Live-x86_64-24-1.2.iso"
MNT_PATH="/mnt/iso"
mount -o loop "$ISO_PATH" "$MNT_PATH"
Scratch ram partition for a fast access:
~# mount -t tmpfs tmpfs /mnt -o size=1024m
View all mounted paritions of specific type:
~$ mount -l -t ext2 ~$ mount -l -t ext4
Bind mount points to a new directory:
~# mount -B /old_mnt /new_mnt
The mountpoint can be binded to a new directory. So that you would be able to access the contents of a filesystem via more than one mountpoints at the same time.
/etc/blkid.conf | |
/etc/filesystems | a list of filesystem types to try |
/etc/fstab | filesystem table |
/etc/mtab | table of mounted filesystems |
/etc/mtab.tmp | temporary file |
/etc/mtab~ | lock file |
/proc/self/mountinfo | |
/usr/lib/locale/locale-archive |
---|
mount(2), umount(2), umount(8), fstab(5), findmnt(8), nfs(5), nfsd(8), xfs(5), xfs_admin(8), mountd(8), mke2fs(8), tune2fs(8), e2label(8), swapon(8), losetup(8)
display sertain part of the path:
#!/usr/bin/env bash
# Default action
GET_PATH="$(pwd)"
DEPTH="2"
echo "$GET_PATH" \
| rev \
| cut -d"/" -f"$DEPTH" \
| rev
# End of script