Category: Linux

curl with cookie authentication

How to download files from sites requiring authenticationHave you ever logged into a website that requires you login before you can download a file? Subsequently, a simple ‘copy-link’ option does not

concatenate a file list into a string

Example 1kreese@myvps:arp $ 205.178.186.72 205.178.136.60 205.178.136.72 205.178.136.91 205.178.136.109 205.178.136.132 205.178.136.166 205.178.186.206 205.178.186.220 206.188.212.32 206.188

ternary example

Just a quick little example on ternary bash syntax. [[ $member = *mongodbarb* ]] && port=30000 || port=27017 Examplereese@MacBook ~ $ node=webserver01 reese@MacBook ~ $ [[ $node = *webserver*

couldn't find device with uuid

Linux LVM commands result in Couldn’t find device with uuid Couldn’t find all physical volumes for volume group Help! Commands like lvs, lvdisplay, vgdisplay, and pvscan result in an error like the

expand alias in shell script

Defining an alias within a shell scriptIf there’s a need to define an alias within a shell script, shopt needs to be defined to tell the script to expand the alias. This option is enabled by default

Rename batch of files

How to rename a batch or group of fileskreese@MacBook ~/wbsvr $ ls -l total 200 -rwx------ 1 kreese 1575811233 34652 Mar 19 16:49 httpd.conf -rw-r--r-- 1 kreese 1575811233 13609 Mar 25 08:30 vho

Zero byte a File

/dev/null (zero out) a bunch of files at oncecd /var/logcat /dev/null | tee {boot.log,cron,dmesg,lastlog,messages,secure,vzctl.log,vznetcfg.log,wtmp} >boot.log>cron>dmesg>message

nmap commands

Scan network for responsive IPsnmap -sS -O 10.199.42.0/23 | tee nmap.log Check if port is opennmap -P0 -p1521 oracle.com Scan UDPnmap -sU -p <port> <target>

netmasks table

Decimal Binary CIDR Hex-------------------------------------------------------------------255.255.255.255 11111111.11111111.11111111.11111111 /32 ffffffff255.

sed Commands

sed one linersInsert character at beginning of lineComment all nfs entries in fstabsed -i '/nfs/s/^/#/' /etc/fstab Uncomment all nfs entries in fstabsed -i '/nfs/s/^#//g' /etc/fstab Su