January 18, 2017

106 words 1 min read

Usefull Linux Commands

Usefull Linux Commands

Search for a string recursively

grep -rnw './' -e "imsearchingyou"

only specific files:

grep -rnw './' --include=".php" -e "imsearchingyou"

or a bit more clearly:

grep -Hornw './' -e "imsearchingyou"

Edit the default version of an alternatives software

update-alternatives --set php /usr/bin/php5.6

Generate super secure passwords

apt install pwgen
pwgen -s -y 32 -N 1

Checking opened ports

apt install nmap
nmap -p 80 test.de

for upd ports:

nmap -sU -p 53 test.de

for localhost:

netstat -tulpn

Add user

sudo adduser --system --shell /bin/bash --group --disabled-password --home /home/anton anton

Add user without login shell

useradd -s /sbin/nologin anton

Add user to group

usermod -a -G groupName anton