IT notes

bash git prompt

To display the current branch in the terminal prompt using bash, add the following lines to ~/.bash_profile: parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } export PS1="\[email protected]\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "

Linux Mac Address

To get the MAC address from an interface in linux: cat /sys/class/net/eth1/address

Linux version

To determine what linux version you are using: cat /etc/*elease


Install gpg on macOS: brew install gnupg pinentry-mac if required restart gpg-agent with gpgconf --kill gpg-agent To create a gpg key in batch mode, create a file named gpg-key-script with this value: Key-Type: 1 Key-Length: 2048 Subkey-Type: 1 Subkey-Length: 2048 Name-Real: your name Name-Comment: your comment Name-Email: [email protected] Expire-Date: 0 Next you could do something like: $ gpg --homedir /salt/gpgkeys --batch --gen-key gen-key-script Backup private key To save the private key to a file:


To disable SElinux temporaly: setenforce 0 To disable SELinux Permanetly, edit file /etc/sysconfig/selinux: # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy.


To print information about your Linux system hardware, run this command. $ apt-get install lshw lshw [email protected]:/# lshw -short H/W path Device Class Description ================================================== system Computer /0 bus Motherboard /0/0 memory 3020MiB System memory /0/1 processor Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz /0/2 processor Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz /0/100 bridge 440FX - 82441FX PMC [Natoma] /0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II] /0/100/1.

debian parted

Resize AWS Debian Jessie Probably instance will have 8GB, to extend the disk, for example to 40GB do this: Install parted: $ apt-get install parted Run: $ /sbin/parted ---pretend-input-tty /dev/xvda resizepart 1 yes 100% Resize2fs: $ resize2fs /dev/xvda1 Run lsblk: [email protected]:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 40G 0 disk `-xvda1 202:1 0 40G 0 part /