bash_oneliners
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
bash_oneliners [2018/01/19 13:56] – admin | bash_oneliners [2023/07/27 13:28] – admin | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | * Remove offending key from known_hosts file with one command | ||
- | < | ||
- | $ sed -i 18d .ssh/ | ||
- | </ | ||
* Whats my WAN IP? | * Whats my WAN IP? | ||
< | < | ||
- | $ dig +short myip.opendns.com @resolver1.opendns.com | + | dig +short myip.opendns.com @resolver1.opendns.com |
</ | </ | ||
* Find large files, print 10 largest files in dir | * Find large files, print 10 largest files in dir | ||
< | < | ||
- | $ find . -printf '%s %p\n' | + | find . -printf '%s %p\n' |
+ | </ | ||
+ | * size of all files older than mtime | ||
+ | < | ||
+ | find . -mtime +7 -print0 | du -hc --files0-from - | tail -n 1 | ||
</ | </ | ||
* To find the largest file in all sub-directories: | * To find the largest file in all sub-directories: | ||
< | < | ||
- | $ find / | + | find . -type f -exec ls -s {} \; | sort -nr | awk 'NR==1 { $1=""; |
</ | </ | ||
* grep for valid IP Addresses. | * grep for valid IP Addresses. | ||
< | < | ||
- | $ grep -E -o " | + | grep -E -o " |
</ | </ | ||
* show used inode count for subdirectories. | * show used inode count for subdirectories. | ||
< | < | ||
find */ | sed ' | find */ | sed ' | ||
+ | </ | ||
+ | * free all caches | ||
+ | < | ||
+ | free && sync && echo 3 > / | ||
+ | </ | ||
+ | * rescan all SCSI buses | ||
+ | < | ||
+ | for i in / | ||
+ | </ | ||
+ | * enlarge LVM | ||
+ | < | ||
+ | fdisk /dev/sdk | ||
+ | #set partition type to Linux LVM (type 8e) | ||
+ | pvcreate /dev/sdk1 | ||
+ | vgextend VolGroupDB /dev/sdk1 | ||
+ | lvextend -l +100%FREE / | ||
+ | resize2fs -p / | ||
+ | #for xfs use xfs_growfs / | ||
+ | parted -a optimal /dev/sdc mklabel gpt | ||
+ | parted -a optimal /dev/sdc mkpart p 0% 100% | ||
+ | parted -a optimal /dev/sdc set 1 lvm on | ||
+ | vgextend VGEXL /dev/sdf1 | ||
+ | lvresize -l +100%free / | ||
</ | </ | ||
+ | * Enlarge LVM 2 | ||
+ | < | ||
+ | echo ' | ||
+ | yum install cloud-utils-growpart | ||
+ | growpart | ||
+ | pvresize /dev/sdd1 | ||
+ | lvextend -l +100%FREE / | ||
+ | xfs_growfs / | ||
+ | </ |
bash_oneliners.txt · Last modified: 2023/07/27 13:28 by admin