User Tools

Site Tools


linux:commands

This is an old revision of the document!


Table of Contents

The page will keep records of Linux commands which i think is helpful.

grep

  1. grep “example” -i -n /etc/libuser.conf
  2. cat /etc/libuser.conf | grep “example” -i -n

the command will find “example” in “/etc/libuser.conf” file and print it with line number

  1. grep “imp” /etc/*.conf –color
  2. grep -i -r –include “*.bash” “domain” ./ –color

find

  1. find /etc -type f -maxdepth 1 -iname “*.conf”

the command will find *.conf files without child directory in “/etc” directory

  1. find /etc -type f -iname “*.conf” -exec grep “example” {} +

the command will find all “example” in all “*.conf” file in “/etc” directory and print the line

crontab

  1. crontab -e

to edit crontab tasks.

add user

  • adduser shaoxp
  • passwd shaoxp
  • gpasswd -a shaoxp wheel
  • sudo adduser shaoxp sudo

above commands will finish add shaoxp as admin user.

awk

  • awk '{print $6 “ ” $1 “ ” $9}' ./file
  • awk '{print $6 “ ” $1 “ ” $9}' ./file| sort -n -r | more
  • cat file | awk -F ' ' '{if($1>10){print $1}}' | wc -l
linux/commands.1546520302.txt.gz · Last modified: 2021/06/01 15:29 (external edit)