IT

Useful commands in Windows Command prompt

— kill process when someone forgets to close Adobe file that you may need to edit:

taskkill /f /s PCNAME_HOSTNAME /FI “IMAGENAME eq Adobe*”

taskkill /s <net_name> /PID 1234 /f

 

–show details when PC was for example rebooted last time:

systeminfo /s PCNAME_HOSTNAME

 

–opened ports
netstat -an | findstr 8016

 

–starting IIS from command line
inetmgr

 

— how to check when my password expires
net user /domain username(AD)

 

–list of windows updates
wmic qfe list
wmic /node:’computer name‘ qfe GET description, hotfixid, installedby, installedon,servicepackineffect > Computer.txt

 

— Powershell – get process name/details based on description value:

PS X:\Pablo> Get-Process | where {$_.description -match ‘Cisco’}

Useful Cygwin / Linux commands

grep command – it is used to find pattern/string in the files:

https://www.man7.org/linux/man-pages/man1/grep.1.html

I use this one pretty often:

$ grep -rnie “string” filename.txt

r- recursive – read all the files under each directory

n- prefix each line of output with line number where pattern was found

i – ignore case

e – search for given pattern

 

another example:

grep -n “YOUR SEARCH STRING” * > output-file

 

sed command 

Stream editor for filtering and transforming text

example to show lines between 11115149 and 11145149 for filename input.

$ sed ‘11115149,11145149!d’ filename.txt