can be used to rename multiple files. In the past it was available out of
the box, but in Ubuntu 19.04 it is not installed by default, and probably
you won't need it - use mv
, or use
GUI file manager (e.g., Nautilus), etc. Of course, if you really need to
perform some non-trivial renaming operation on a large number of files, then:
sudo apt install rename
It looks like there are several versions of rename
with
different syntax. The version I've installed turned to be a PERL script
/usr/bin/file-rename. I say, before you try smth with this
program, read manual, or at least run:
rename --help
The syntax is a little bit confusing for a program named rename:
rename
[options] perlexpr files
or
rename
[options] 's/expr/repl/' files
It's supposed to rename the specified file(s) by replacing the first occurrence of expr in their name with repl. Both expression and replacement are PERL regex.
rename 'y/A-Z/a-z/' *
convert all filenames in the curr dir to lowercase;
rename 's/\.jade$/\.pug/' *.jade
change file extension from .jade to .pug for all matching files (*.jade) in the curr dir;
rename 's/\.bak$//' *.bak
strip the .bak ext from all matching files;
Options
-h
, --help
-V
, --version
-v
, --verbose
-0
, --null
use \0 as record separator when reading from stdin;
-d
, --filename
,
--nopath
, --nofullpath
do not rename directories, only rename filename components of the full path;
-e |
expression: code to act on filenames; may be repeated
to build up code (like "perl -e "); without this option the first
arg is used as code; |
-E |
statement: code to act on filenames; like prev, but terminated with ';' |
-f
, --force
overwrite existing files;
-n
, --no-act
, or maybe --nono
show what will be done, but do not make any changes
(add -v
for details);
--path
, --fullpath
rename full path including any dir components (default);
Some versions of rename use these options:
-i
, --interactive
ask before overwriting existing files;
-o
, --no-overwrite
do not overwrite existing files; if --symlink
is active, do not overwrite symlinks pointing to existing targets;
-s
, --symlink
do not rename a symlink, rename its target;
alters the scheduling priority of one or more running processes.
renice
pri [[-p
] pid ...]
[[-g
] pgrp ...] [[-u
] user ...]
Negative pri increases priority, positive - decreases.
By default the processes are specified by PID. -g
causes all
processes in the specified process group to be affected, -u
causes all processes of the specified user to be affected.
Superuser can ~
any process and change priority in the
range from PRIO_MIN (-20) to PRIO_MAX (20).
Other users can only control their own processes, and the available range
is from 0 to 20.
renice +15 1234
slow down the process with PID = 1234;
renice +20 -u alex
slow down all processes of alex;
removes files and directories, though does not remove dirs by default.
rm message2.txt
remove file message2.txt;
rm -- -f
remove file with an unusual name -f;
rm ./-f
same as previous;
rm -r install
remove dir install recursively;
rm -f *
remove all files, never ask;
rm -d temp1
unlink directory temp1;
rm
[options] file ...
Options
--help
--version
-v
--verbose
-d
, --dir
remove empty directories;
-f
, --force
never prompt, ignore non-existent files and arguments;
-i |
prompt before every removal; |
-I |
prompt once before removing more than three files, or when removing recursively; |
--interactive
[=never
|once
|always
]
prompt before removal: never is never,
once is like -I
, always (default)
is like -i
;
--one-file-system
when removing a hierarchy recursively, skip any dir that is on a file system different from that of the corresponding cmdline arg;
--no-preserve-root
do not treat '/' specially;
--preserve-root
do not remove '/' (default);
-r
, -R
,
--recursive
remove dirs and their contents recursively;
removes empty directories.
rmdir -p temp/misc/work
remove dir work, then try to remove dirs misc and temp;
rmdir
[options] dir ...
Options
--help
--version
-v
--verbose
-p
, --parents
remove dir, then try to remove each dir component of that path name;
--ignore-fail-on-non-empty
ignore failures that happen because dirs are not empty;
Deprecated
manipulates the kernel's IP routing tables (mainly to set up the static
routes). When add
or del
are used, ~
modifies kernel table, otherwise, displays current contents.
route -n
show routing table using numerical addresses;
route add -net 127.0.0.0
add the normal loopback entry, using netmask 255.0.0.0
and associated with lo device (assuming it was previously set up
with ifconfig
);
route add -host 192.168.12.190 dev eth0
add route to the host 192.168.12.190 via eth0;
route add -net 192.168.12.0
netmask 255.255.255.0 gw 192.168.4.250
add a route to the network 192.168.12.0/24 via the gateway 192.168.4.250;
route del default gw 192.168.0.247
remove default gateway 192.168.0.247;
route add default gw 192.168.0.254
add default gateway 192.168.0.254;
route add -net 10.0.0.0 netmask 255.0.0.0 reject
install a rejecting route for the private network 10.0.0.0;
Options
-h
--help
-V
--version
-v
--verbose
-A
family
use the specified address family: inet (default),
inet6, ax25, ipx,
.. (for a list of currently supported families run route --help
);
-C |
operate on the kernel’s routing cache; |
-F |
operate on the kernel’s FIB (Forwarding Information Base) routing table (default); |
-e |
use netstat format to display the routing table; |
-gw
gateway
route packets via a specified gateway (usually you have to set up a static route to this gateway first);
-host
the target is a host;
-net
the target is a net;
-netmask mask
when adding a network route use the specified netmask;
-n |
show numerical addresses; |
add
add new route;
del
delete a route;
dev
iface
force route to be associated with the specified dev;
metric
n
set the metric field in the routing table;
mss
n
set TCP MSS (Maximum Segment Size) for connections over this route to n bytes (default is MTU minus headers);
Output
Destination | the destination network or host; | ||||||||||||||||||
Gateway | the gateway address or * if none set; | ||||||||||||||||||
Genmask | the netmask for the destination net; 255.255.255.255 for host destination, 0.0.0.0 for the default route; | ||||||||||||||||||
Flags |
| ||||||||||||||||||
Metric | the distance to the target (in hops); | ||||||||||||||||||
Ref | number of references to this route; | ||||||||||||||||||
Use | count of lookups for the route; | ||||||||||||||||||
Iface | interface to which packets for this route will be sent; |
(Red Hat Package Manager) is used to install, update, remove (erase), query, verify and build individual software packages.
rpm -i foobar-1.0-1.i386.rpm
install package foobar-1.0-1.i386.rpm;
rpm -U --force foobar-1.0-1.i386.rpm
upgrade package foobar... that was installed earlier;
rpm -Uvh postfix-XXXX.rpm
upgrade package postfix-XXXX (use verbose mode and show progress marks);
rpm -e foobar-1.0.0.i386
remove package foobar...;
rpm -Va
check if some of installed files are missing;
rpm -qa
list all installed packages;
rpm -qa | grep openoffice
list all installed packages related to OpenOffice;
rpm -qf /usr/X11R6/bin/xjewel
find what package this file belongs to;
rpm -qpi koules-1.2-2.i386.rpm
report what is this package for;
rpm -qpl koules-1.2-2.i386.rpm
list files this package is going to install;
rpm --import http://freshrpms.net/packages/RPM-GPG-KEY.txt
import GnuPG public key from freshrpms.net;
A package includes a file archive + metadata (helper scripts, file attributes, package description). There are 2 types of packages: binary and source.
rpm
{-i
| --install
} [options] package
rpm
{-U
| --upgrade
} [options] package
rpm
{-F
| --freshen
} [options] package
rpm
{-e
| --erase
} [options] package
rpm
{-q
| --query
} [select_opts] [query_opts]
rpm
{-V
| --verify
} [select_opts] [verify_opts]
rpm --initdb
[-v
] [--dbpath
dir] [--root
dir]
create a new RPM database;
rpm --rebuilddb
[-v
] [--dbpath
dir] [--root
dir]
rebuild database indices from the installed pkg headers;
There are also: Uninstall, Signature Check, Resign, Add Signature, Set Owners / Groups, Show Query-tags, Show Configuration.
Options
-?
--help
--version
-v
--verbose
--dbpath
dir
use the database in dir rather then the default path (/var/lib/rpm);
--pipe
cmd
pipe the output of ~
to the command
cmd;
--quiet
quiet mode (only error message are displayed);
--rcfile
list
each of the files in the colon-separated list is read sequentially for configuration info; the default is:
/usr/lib/rpm/rpmrc;
/usr/lib/rpm/red-hat/rpmrc;
/etc/rpmrc/:~/.rpmrc;
--root
dir
use the filesystem tree rooted at dir for all ops;
Install / Upgrade options
--install
is appropriate, if the package is not installed.
Otherwise, use --upgrade
, which installs a newer version and
removes all other versions. --freshen
installs only if an
earlier version exists.
--excludedocs
don't install any files which are marked as documentation (manpages, texinfo, etc);
--force
,
--replacepkgs
, --replacefiles
install the pkgs even if they replace files from other, already installed, pkgs;
-h
, --hash
print 50 hash marks as the package archive is unpacked
(use with -v
, --verbose
);
--ignoresize
don't check disk space before installation;
--ignorearch
install/upgrade even if the architectures of the binary package and host don't match;
--ignoreos
install/upgrade even if the operating systems of the binary package and host don't match;
--nodeps
don't check dependencies before installation;
--nodigest
don't verify package or header digest;
--nosignature
don't verify package or header signatures;
--oldpackage
allow to replace a newer pkg with an older;
--prefix
newpath
for relocatable binary pkgs, translate all file paths that start with the installaion prefix in the pkg relocation hint(s) to newpath;
--test
do not install, just check and report potential conflicts;
Remove (erase) options
--allmatches
remove all versions of the package;
--nodeps
don't check dependencies before uninstalling;
--test
do not really uninstall, just simulate the procedure;
Query options
-a
, --all
query all installed packages;
-f
file,
--file
file
find what package this file belongs to;
--whatprovides
capability
query all packages that provide the specified capability;
--whatrequires
capability
query all packages that require the specified capability for proper functioning;
Query options (specific package)
-i
, --info
display package info (name, version, description);
-l
, --list
list files in the package;
-R
, --requires
list packages on which this pkg depends;
-s
, --state
display the states of the files in the package; the states are: normal / not installed / replaced;
--changelog
display change info on this package;
--filesbypkg
list all files in each selected package;
--dump
dump file info in a special format: path size mtime md5sum mode owner group isconfig isdoc rdev symlink;
--provides
list the capabilities this package provides;
--scripts
list the package specific scriplets that are used as part of the installation / uninstallation processes;
Verify options
Verification procedure compares info about the installed files with info about the files taken from the package metadata stored in the rpm database.
--nodeps
don't verify dependencies;
--nodigest
don't verify package or header digest;
--nofiles
don't verify file attributes;
--nosignature
don't verify package or header signatures;
--nosize
, --nouser
,
--nogroup
, --nomtime
, --nomode
don't verify the corresponding file attribute;