Skip to content

linux cmd backup #12

Description

@etaf

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions