Skip to main content

Cheat Sheet

echo $? - exit status of last command (0 no error)
' - Single quote removes meaning special meaning of special character.
find /qwe -type f -iname *.js -exec cp --parents -t /tmp/ {} + -- find all js files and copy with parent directory
ystemctl set-default (ls -l /lib/systemd/system/runlevel*) -- set runlevel
echo <password> | sudo -S

for i in t@01 st@02 ba@sta03;do ssh -o RequestTTY=true $i "sudo -l";done -- allow tty present

:r! sed -n '16,812 p' < input_file.txt -- copy line range from input_file
:1,10d -- delete line from 1 to 10
:se nu -- show line numbers

Redirection in Apache (By default, the Redirect directive establishes a 302, or temporary, redirect.):
<VirtualHost *:80>
Redirect 301 /oldlocation

ServerTokens Prod -- hides Apache version

vi /etc/logrotate.d/

iptables -A INPUT -p tcp -m tcp --dport 5000 -j DROP -- discard incoming traffic
iptables -A INPUT -p tcp -m tcp --dport 8094 -j ACCEPT -- allow incoming traffic
iptables -D INPUT -p tcp -m tcp --dport 5000 -j DROP -- Delete rule
iptables -I INPUT -p tcp ! -s yourIPaddress --dport 22 -j DROP -- discard incoming traffic for posrt 22 except yourIPaddress
iptables-save >/etc/sysconfig/iptables -- save rules

git init -- creates .git folder
Files are untracked when first created
git add -- to start tracking (stage all files and changes in the current folder)
git diff --staged show changes on added files


Popular posts from this blog

Reset root pass in ESXi 5.5

    In this post i will show how to reset root password in ESXi 5.5. For this first we need any bootable linux distributor. In my example i used Ubuntu 16.04.     Boot from Ubuntu disk. Select try Ubuntu, wait for loading. After full loading open Terminal. Type fdisk -l for list all partitions hypervisor/system image is located on the first 250 MB partition (/dev/sda5) which contains the state.tgz file. Mount /dev/sda5 to /mnt sudo -s mount /dev/sda5 /mnt. Go to the /mnt cd /mnt . Copy state.tgz to /tmp folder cp state.tgz /tmp , cd /tmp. Unarchive state.tgz tar xzf state.tgz then   tar xzf local.tgz Go to the /etc directory in /tmp folder  cd etc/ . For deleting resetting password open shadow file with nano shadow  delete the password hash of ESXi root account. Close nano editor. Re add etc/ folder to local.tgz : tar czf local.tgz etc after it readd local.tgz to state.tgz: tar czf state.tgz local.tgz . Copy state.tgz mnt/ folder: cp state.tgz /mnt/ . umount /mnt