Commit graph

197 commits

Author SHA1 Message Date
Karel Zak
a5a9b54429 swapon: add --fstab command line option
Let's add --fstab mount option for compatibility with mount(8).

Addresses: https://github.com/util-linux/util-linux/issues/2017
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-01-16 13:47:36 +01:00
Thomas Weißschuh
9d4028ff86 waitpid: adapt bash-completion for current functionality 2023-01-09 13:16:30 +00:00
Thomas Weißschuh
550d32c49e waitpid: add new command
This command implements waiting for the exit of multiple processes.
Especially it allows to wait for process that are not children of the
current process.

In contrast to wait(1P) it does not allow to retrieve the processes exit
codes.
2023-01-04 01:18:33 +00:00
Thomas Weißschuh
d883f868a8 umount: properly handle special characters in completion
Fixes #1834
2022-12-27 03:22:23 +00:00
Karel Zak
85a956a709 hardlink: cleanup options
* add missing stuff to bash-completion
* reorder --help output
* reorder man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2022-12-08 11:12:47 +01:00
Karel Zak
21a73da6c6 bash-completion: add blkdiscard --quiet
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-12-07 11:13:48 +01:00
Karel Zak
1325de1756 rename: (bash-completion) fix typo
Fixes: https://github.com/util-linux/util-linux/issues/1928
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-28 09:47:18 +01:00
Karel Zak
1e6393de06 bash-completion: add --zero to rev module
Addresses: https://github.com/util-linux/util-linux/pull/1900
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-16 08:48:43 +01:00
Daniel Peukert
3383356263
rfkill: add toggle to bash completion
Signed-off-by: Daniel Peukert <daniel@peukert.cc>
2022-11-08 19:48:08 +01:00
Karel Zak
86938d0633 bash-completion: update lsns
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-08 10:11:57 +01:00
Masatake YAMATO
84b63b62f0 fadvise: add bash-completion script
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-10-06 03:05:07 +09:00
zhenwei pi
3b26273394 lsblk: introduce 'MQ' column
Typically a modern block device supports mutil queues feature, count
queues by walking '$sysfs/mq' directory. If no '$sysfs/mq' exists, it
is a legacy single queue.

~# lsblk --nvme -o NAME,TYPE,MODEL,TRAN,RQ-SIZE,MQ
NAME    TYPE MODEL                      TRAN   RQ-SIZE  MQ
nvme0n1 disk INTEL SSDPF2KX038TZ        nvme      1023 135
nvme3n1 disk INTEL SSDPE2KX020T8        nvme      1023 128
nvme1n1 disk SAMSUNG MZQL23T8HCLS-00A07 nvme      1023 129
nvme2n2 disk RP2A03T8RK004LX            nvme      1023  64
nvme2n3 disk RP2A03T8RK004LX            nvme      1023  64

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
zhenwei pi
1b3e8f5d2c lsblk: add -v/--virtio
Add -v/--virtio to filter the virtio block devices.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
zhenwei pi
97afabf71b lsblk: add -N/--nvme
Add -N/--nvme to filter NVMe device only, NVMe usually has a larger
I/O depth, also show COL_RQ_SIZE by default.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-06-06 12:31:56 +02:00
Karel Zak
6be39224f3 column: add --table-maxout
Add option to fill all available space.

Fizes: https://github.com/util-linux/util-linux/issues/1700
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-06-06 11:45:07 +02:00
Nathan Sharp
80af57ed9e pipesz: add bash-completion script
Signed-off-by: Nathan Sharp <nwsharp@live.com>
2022-05-18 10:35:34 +02:00
zhenwei pi
4b2fadb1bc irqtop: support -C/--cpu-list
Specify cpus list format to show by -C/--cpu-list parameters, for
example, on an AMD server with 192 CPUs, to show statistics on NUMA
node 1:
  ~# ./irqtop -d 1 -C 48-95,144-191

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-04-01 10:21:31 +02:00
Bastian Krause
b22b78b1be hwclock: add --param-set option
Implement the RTC_PARAM_SET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-set hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback and for values, hexadecimal (if prefixed with 0x) and decimal
values, as defined in [2], are accepted.

Example:

  $ hwclock --param-set bsm=0x0

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2022-01-28 11:37:47 +01:00
Bastian Krause
6097b12df7 hwclock: add --param-get option
Implement the RTC_PARAM_GET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-get hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback, hexadecimal (if prefixed with 0x) and decimal values, as
defined in [2], are accepted.

Example:

  $ hwclock --param-get features

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
2022-01-28 11:37:47 +01:00
Karel Zak
c18ed0a6e6 build-sys: install lastb bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-01-04 12:05:58 +01:00
Karel Zak
c4762c436b sfdisk add --backup-pt-sectors
The current option --backup is usable only when used with others sfdisk
commands. The new command --backup-pt-sectors create backup and exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-12-09 12:07:16 +01:00
Karel Zak
0cbb001a1e nsenter: add --wdns to change working directory
The current --wd=<dir> changes CWD to the path which is opened
*before* nsenter calls setns(). It may be useful if you want to use in
namespace something from your current namespace.  In this case, the
option --wd works like a "tunnel" between namespaces.

For some other use-cases, this is useless and you want to be sure that
CWD always points to the target namespace. For this purpose this patch
implements --wdns <dir>.

Example:

 Setup the namespaces:

  # unshare --mount
  # mount /dev/sdc /mnt/A
  # touch /mnt/A/fooooo
  # echo $$
  2425872

 Enter the namespace from another session:

  # nsenter --all --target 2425872 --wd=/mnt/A ls -a
  .  ..

  # nsenter --all --target 2425872 --wdns=/mnt/A ls -a
  .  ..  fooooo  lost+found

Fixes: https://github.com/util-linux/util-linux/issues/1500
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-22 13:18:54 +01:00
Karel Zak
d1732bba38 bash-completion: fix irqtop
Forgot update the option as introduced by commit
17f7caa451.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 10:56:02 +01:00
zhenwei pi
17f7caa451 irqtop: add -c/--cpu-stat option
Since a23aecc1bf("irqtop: add per-cpu stats"), irqtop always shows
per-cpu stats. Test on a modern AMD server with 2 socket(256 CPU),
irqtop shows messy output with too many columns.

In this patch, add -c/--cpu-stat option to enable/disable per-cpu stats.
And 'auto' option auto-detect window size, only show per-cpu stats
if the length of per-cpu stats is shorter than the width of window.

[kzak@redhat.com: - shorten the commit message
                  - rename --cpu to --cpu-stat
                  - use scols_table_enable_nowrap() rather than trim in irqtop.c
                  - reduce --help for the new option]

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 10:35:50 +01:00
Karel Zak
b1c137a948 bash-completion: add --json to dmesg
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-11-10 09:31:53 +01:00
Karel Zak
059811d096 su: (bash-completion) offer usernames rather than files
Fixes: https://github.com/karelzak/util-linux/issues/1424
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-31 12:51:40 +02:00
Naohiro Aota
ca5f4bd0d6 lsblk: add columns of zoned parameters
Several parameters for zoned devices are missing from lsblk's columns. This
commit introduces them as following.

 ZONE-SZ     zone size
 ZONE-WGRAN  zone write granularity
 ZONE-APP    zone append max bytes
 ZONE-NR     number of zones
 ZONE-OMAX   maximum number of open zones
 ZONE-AMAX   maximum number of active zones

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
2021-08-31 10:24:20 +02:00
Karel Zak
5a72054bd0 mount: add -m,--mkdir as shortcut for X-mount.mkdir
Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-12 13:51:57 +02:00
Smitty
e091d5b7b1 whereis: use commands for Bash completions
Currently, the Bash completions for `whereis <TAB>` gives
`whereis file` ("file" is not a placeholder here, it literally expands
to that). This fixes that by passing the `-c` flag to `compgen` to
request completions for command names.

Signed-off-by: Smitty van Bodegom <me@smitop.com>
2021-08-08 18:04:30 -04:00
Todd Lewis
a2b23d3a91 rename: add --all and --last parameters
Renaming files with rename often involves multiple passes in order
to, say, replace all spaces with underscores because traditionally
rename only replaces the first occurrence of the expression. The
--all parameter makes this task simple.

With the addition of --last, rename becomes much safer to use when
replacing file extensions, whereas before it would mangle a file
which had its extension also embedded elsewhere in its name.

The implied --first, together with --all and --last, round out the
common cases for renaming files.
2021-07-15 00:15:55 -04:00
Karel Zak
ab2eea4ac3 build-sys: install hardlink bash-completion
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 11:14:36 +02:00
Ville Skyttä
ca59e01e39 bash-completion: (lsblk) fix -E/-M arg (non-)completion
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2021-04-16 22:08:48 +03:00
Luca Boccassi
e18f057b56 Automake: install uuidgen bash completion only if it is built
Check for BUILD_UUIDGEN instead of BUILD_LIBUUID
2021-03-15 12:26:27 +00:00
Qais Yousef
860112cb21 uclampset: Plumb in bash-completion
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
2021-02-02 10:56:26 +00:00
Dmitriy Chestnykh
0d182490e3 cfdisk: Implemented cfdisk's opening in read-only mode
[kzak@redhat.com: - clean up the patch
                  - add note "Changes will remain in memory only."]

Addresses: https://github.com/karelzak/util-linux/issues/1209
Addresses: https://github.com/karelzak/util-linux/pull/1213
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-04 12:17:57 +01:00
Karel Zak
732d75945e dmesg: add --since and --until
$ date
Wed 21 Oct 2020 12:05:07 PM CEST

$ dmesg --ctime --since '1 hour ago'
[Wed Oct 21 11:47:13 2020] AAA
[Wed Oct 21 11:55:48 2020] BBB

$ dmesg --ctime --since '1 hour ago' --until '10 minutes ago'
[Wed Oct 21 11:47:13 2020] AAA

Addresses: https://github.com/karelzak/util-linux/issues/1166
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-21 12:09:18 +02:00
Karel Zak
a83bea2d3d bash-completion: (lsblk) update columns
and fix lsblk --help output

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-12 13:19:35 +02:00
Karel Zak
7636d906ef lsblk: add --width option
Addresses: https://github.com/karelzak/util-linux/issues/1160
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-12 12:19:48 +02:00
Lennard Hofmann
f01e54d7a1 column: Deprecate --table-empty-lines in favor of --keep-empty-lines
`--table-empty-lines` gives the false impression that the option
only applies to table mode.

Signed-off-by: Lennard Hofmann <lennard.hofmann@web.de>
2020-09-29 12:38:18 +02:00
Karel Zak
701f0385a0 mkswap: add --verbose, reduce extents check output
We do not need to provide details in the default output. It seems
better to hide it behind --verbose to be user-friendly.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-09-10 12:54:14 +02:00
Karel Zak
d3f21dca1e bash-completion: add column --table-columns-limit
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-08-25 14:23:28 +02:00
Karel Zak
6e7fb6c49a bash-completion: add irqtop/lsirq --softirq
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-23 12:23:56 +02:00
Sami Kerola
5adb0c9066 bash-completion: release preparations
6e103c7690 blkzone: Add --force option
9cd88771ef fdisk: add --lock and LOCK_BLOCK_DEVICE
921ceaca31 wipefs: add --lock and LOCK_BLOCK_DEVICE
c3ef1268a0 sfdisk: add --lock and LOCK_BLOCK_DEVICE
b8671fe763 mkswap: add --lock and LOCK_BLOCK_DEVICE
ec8f712157 cfdisk: add --lock and LOCK_BLOCK_DEVICE
f2229320a9 fdisk: add --noauto-pt
7f1f0584c2 nsenter: add support for the time namespace
dd52c4fa01 lsirq: add -n option
ee5a160250 sfdisk: add --relocate command
99d78b2fef fdisk: add --list-details
65e27d545c sfdisk: add --disk-id to change disk UUID/ID
34fed3ff17 blkdiscard: use O_EXCL, add --force

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-06-15 11:35:40 +02:00
Konstantin Khlebnikov
d7881b0ed5 dmesg: add --follow-new
Option --follow-new (-W) works the same as --follow (-w) but initially
seeks to the end of kernel ring buffer, so it prints only new messages.
Useful for capturing kernel messages during actions without past log.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
2020-06-01 09:55:49 +02:00
Karel Zak
9995da01e0 fstrim: add --listed-in <file[:file ..]>
This new option works like --all but it allows to specify multiple
files with filesystems to make fstrim configuration more portable
between distributions. For example:

 fstrim --listed-in /etc/fstab:/proc/self/mountinfo

forces fstrim to try fstab and if unsuccessful than try mountinfo.

Addresses: https://github.com/karelzak/util-linux/issues/1019
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-22 14:48:31 +02:00
Karel Zak
9a293ca078 bash-completion: chmod -x
Addresses: https://github.com/karelzak/util-linux/issues/1042
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-22 12:02:25 +02:00
Etienne Mollier
2c12297400 bash-completion/umount: shell charaters escape
This patch brings support for automatic dangerous shell characters
escape in umount autocompletion.  Due to the very peculiar way for
bash to handle autocompletion routines, proper escaping of the shell
sequences only worked properly inside a function: _umount_point_list,
which will add to the user's namespace at the next umount attempt of
autocompleting mount point.

It also translates calls of gensub to the portable alternatives sub
and gsub, in order to allow the use of various awk implementations
(mawk, Gnu, Busybox, etc), and as such kind of undoes a recent change
to enforce the use of Gnu awk. The whole story landed into the Debian
BTS initially:

	https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933934

PS: It's been a few months since the patch is available, sorry for the
    delay; I only got myself a Github account quite recently...

Signed-off-by: Étienne Mollier <etienne.mollier@mailoo.org>
2020-05-21 17:44:22 +02:00
Aurelien LAJOIE
27fafcf8a8 cal: Add column mode
Add`-v` `--vertical` option to get a vertical output
Add it into relative bash-completion

For example `cal -yv`

                             2020

    January            February           March
Su     5 12 19 26         2  9 16 23      1  8 15 22 29
Mo     6 13 20 27         3 10 17 24      2  9 16 23 30
Tu     7 14 21 28         4 11 18 25      3 10 17 24 31
We  1  8 15 22 29         5 12 19 26      4 11 18 25
Th  2  9 16 23 30         6 13 20 27      5 12 19 26
Fr  3 10 17 24 31         7 14 21 28      6 13 20 27
Sa  4 11 18 25         1  8 15 22 29      7 14 21 28

    April              May                June
Su     5 12 19 26         3 10 17 24 31      7 14 21 28
Mo     6 13 20 27         4 11 18 25      1  8 15 22 29
Tu     7 14 21 28         5 12 19 26      2  9 16 23 30
We  1  8 15 22 29         6 13 20 27      3 10 17 24
Th  2  9 16 23 30         7 14 21 28      4 11 18 25
Fr  3 10 17 24         1  8 15 22 29      5 12 19 26
Sa  4 11 18 25         2  9 16 23 30      6 13 20 27

    July               August             September
Su     5 12 19 26         2  9 16 23 30      6 13 20 27
Mo     6 13 20 27         3 10 17 24 31      7 14 21 28
Tu     7 14 21 28         4 11 18 25      1  8 15 22 29
We  1  8 15 22 29         5 12 19 26      2  9 16 23 30
Th  2  9 16 23 30         6 13 20 27      3 10 17 24
Fr  3 10 17 24 31         7 14 21 28      4 11 18 25
Sa  4 11 18 25         1  8 15 22 29      5 12 19 26

    October            November           December
Su     4 11 18 25      1  8 15 22 29         6 13 20 27
Mo     5 12 19 26      2  9 16 23 30         7 14 21 28
Tu     6 13 20 27      3 10 17 24         1  8 15 22 29
We     7 14 21 28      4 11 18 25         2  9 16 23 30
Th  1  8 15 22 29      5 12 19 26         3 10 17 24 31
Fr  2  9 16 23 30      6 13 20 27         4 11 18 25
Sa  3 10 17 24 31      7 14 21 28         5 12 19 26
2020-05-11 17:27:06 +02:00
Wolfram Sang
76f969fe6f bash-completion: umount explicitly needs gawk
gensub() is a gawk extension, so use it explicitly. Otherwise users will
get an error if their 'awk' defaults to something else.

Fixes: 3ebfc8d37 ("bash-completion: umount support relative path and ~ as home shorthands")
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2020-04-29 12:27:14 +02:00
Sami Kerola
e3cb27f535
more: use getopt_long() to parse options
This commit also includes fix to how initial skip lines and search are
instructed in the code.  Earlier version was pretty close impossible to make
work with getopt_long() and had minor flaw - if both initial skip lines and
search were defined at the same time the skipping did not happen.  That is
now corrected.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-04-13 12:14:08 +01:00