mrvova.blogg.se

Grep cheat sheet
Grep cheat sheet






grep cheat sheet
  1. #Grep cheat sheet how to#
  2. #Grep cheat sheet free#

  • Brendan Gregg has a more detailed explanation of how to use strace.
  • grep cheat sheet

  • See the strace zine for a quick walkthrough.
  • #Grep cheat sheet free#

    The '-h' gives the data in human-readable values df -h # size of each file/dir and its contents in the current dir du -hd 1 # or alternative du -h -max-depth =1 # find files greater than certain size(k, M, G) and list them in order # get rid of the + for exact, - for less than find / -type f -size +100M -print0 | xargs -0 du -hs | sort -h # Find free memory on a system free -m # Find what processes are using memory/CPU and organize by it # Load average is 1/CPU for 1, 5, and 15 minutes top -o %MEM top -o %CPU Strace # strace a process strace -tt -T -f -y -yy -s 1024 -p # -tt print timestamps with microsecond accuracy # -T print the time spent in each syscall # -f also trace any child processes that forked # -y print the path associated with file handles # -yy print socket and device file handle details # -s max string length to print for an event # -o output file # run strace on all puma processes ps auwx | grep puma | awk '' | xargs strace -tt -T -f -y -yy -s 1024 -o /tmp/puma.txtīe aware that strace can have major impacts to system performance when it is running. name 'filename.rb' -print # locate a file locate # see command history history # search CLI history -R File contents # -B/A = show 2 lines before/after search_term grep -B 2 -A 2 search_term # - shows both before and after grep -2 search_term # Search on all files in directory (recursively) grep -r search_term # search through *.gz files is the same except with zgrep zgrep search_term # Fast grep printing lines containing a string pattern fgrep -R string_pattern CLI # View command history history # Run last command that started with 'his' (3 letters min) !his # Search through command history -R # Execute last command with sudo sudo !! Managing resources Memory, Disk, & CPU usage # disk space info.

    grep cheat sheet

    System Commands Distribution Information # Debian/Ubuntu uname -a lsb_release -a # CentOS/RedHat cat /etc/centos-release cat /etc/redhat-release # This will provide a lot more information cat /etc/os-release Shut down or Reboot shutdown -h now reboot Permissions # change the user:group ownership of a file/dir chown root:git # make a file executable chmod u+x Files and directories # create a new directory and all subdirectories mkdir -p dir/dir2/dir3 # Send a command's output to file.txt, no STDOUT ls > file.txt # Send a command's output to file.txt AND see it in STDOUT ls | tee /tmp/file.txt # Search and Replace within a file sed -i 's/original-text/new-text/g' See all set environment variables env Searching File names # search for a file in a filesystem find. Contributions are welcome to help add them. Most of the commands below have not been labeled as to which distribution they work If you are a GitLab Support Engineer, consider this a cross-reference to If you are administering GitLab you are expected to know these commands for your distribution

    grep cheat sheet

    Having an issue with GitLab, you may want to check your support optionsįirst, before attempting to use this information. It is listed here for transparency,Īnd it may be useful for users with experience with Linux. This is the GitLab Support Team's collection of information regarding Linux, that they








    Grep cheat sheet