Skillnad mellan versioner av "Generic-cli"
Från wiki.soltec.se
Js146669 (Diskussion | bidrag) |
Js146669 (Diskussion | bidrag) |
||
Rad 57: | Rad 57: | ||
0 goto start of line | 0 goto start of line | ||
$ goto end of line | $ goto end of line | ||
− | :set number display line numbers | + | :set number <--to display line numbers |
+ | :color desert <--to change display colours | ||
Versionen från 28 augusti 2017 kl. 14.40
Disks/PV/VG/LV info
Display a more readable output of disks/vols/mountpoints on Linux
# lsblk -i
Physical Volumes
# pvscan # pvdisplay
Volume Groups
# vgscan # vgdisplay # vgchange # vgrename # vgs
Logical Volumes
# lvscan # lgscan # lvdisplay # lvchange # lvs # lvresize # lvextend # lvreduce # lvrename
RPM
Find out what pkg a file belongs to
# rpm -qf <path-to-file/cmd>
Find out if a file was installed as part of a pkg
# rpm -ql /usr/liblibXp.so.6
Display system-wide config files for a cmd
# rpm -qcf /bin/bash
Check contents of RPM
# rpm -qlp RPMTOPDIR/RPMS/x86_64/<name-of-pkg>.rpm
To view different architecture version of a pkg
# rpm -q --queryformat "%{name}.%{arch}\n" pdksh-5.2.14-36.el5
GREP
grep for soltec in start of line
# grep ^"soltec"
grep for soltec at end of line
# grep "soltec"$
YUM
to install all pkgs in listed in file
# yum install $(< test.txt) # yum -y install $(cat list)
Display history
# yum history # yum history info # yum history list
VI
dG delete from line to end of file d1G delete to top including current line dgg delete from line to start of file G goto last line in file 1G to to first line in file 0 goto start of line $ goto end of line :set number <--to display line numbers :color desert <--to change display colours
Copy/Move data
To move data on the same system, use the following:
# cd dir1 && tar -cf - . | (cd dir2 && tar -xpvf -)
dir1 is the directory you want to copy. dir2 is the directory in which you want the copy to go. This tar’s the current directory to STDOUT, then changes directory, and untar’s the archive without ever having to find the space for a .tar file.
Use the following to do this across systems via ssh:
# cd dir1 && tar -cf - . | ssh system2 "cd dir2 && tar -xpvf -"
RSYNC/RSYNCD
Use rysncd instead of rsync to use resources on the target system copying the data instead of source server