Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux cmd backup #12

Open
etaf opened this issue Aug 12, 2014 · 0 comments
Open

linux cmd backup #12

etaf opened this issue Aug 12, 2014 · 0 comments

Comments

@etaf
Copy link
Owner

etaf commented Aug 12, 2014

To see etaf belongs to which group:

groups etaf 

Change etaf's default group to new_group:

usermod -g new_group etaf

find all the core file and remove them

find ~ -regex ".*core\.[0-9]*" | xargs rm

redirect stderr to file

cmd 2> stderr.txt

redirect stdout and stderr to file

cmd >file 2>&1
##first redirect stderr to stdout , then redirect stdout to file 
``

vim replace

:%s/origin_pattern/new_string/cig

kill multi process with one line

kill $(ps aux | grep '[p]ython csp_build.py' | awk '{print $2}')
Details on its workings are as follows:

first try kill -15 $(....)
if not help try kill -9

  • The ps gives you the list of all the processes.
  • The grep filters that based on your search string, [p] is a trick to stop you picking up the actual grep process itself.
  • The awk just gives you the second field of each line, which is the PID.
  • The $(x) construct means to execute x then take its output and put it on the command line. The output of that ps pipeline inside that construct above is the list of process IDs so you end up with a command like kill 1234 1122 7654.

run command without shell

nohup command &

format code

indent -linux x.cpp
or:
clang-format -i -style=xxx *.cpp

arp scan

sudo arp-scan -I eth0 -l

find excutabe file

find -type f -perm /u=x -exec ls -l {} \;

find ip of a ASUS server which has open port 80;

sudo arp-scan -l | grep ASUS | awk '{print $1}' | xargs nmap -p 80 | grep -A 1 -B 3 "open"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant