Skip to content

Latest commit

 

History

History
141 lines (107 loc) · 1.96 KB

terminal_tips_tricks.md

File metadata and controls

141 lines (107 loc) · 1.96 KB

Everything in src folder and everything in every folder

src/**/*

Shows 10 biggest directories by size in MB

du -cms .[^.]*/ */ | sort -rn | head

Shows all processes

ps ax

Find files by extension

find $dir -type f -name '*.txt'

Install tar.gz

sudo tar xzvf archive-name.tar.gz
cd archive-name
./configure
make
sudo make install

Install dotfiles with stow

stow -t ~/ *

Setup debugger for chrome with chromium

sudo ln -s /usr/bin/chromium /usr/bin/google-chrome

Grep usage example

urxvt --help 2>&1 | grep font

2> redirects stderr to an (unspecified) file, appending &1 redirects stderr to stdout

Install .deb package

  1. Depackage

    sudo dpkg -i /path/to/deb/file

    When dpkg install a package and package dependency is not satisfied, it leaves the package in unconfigured state and that package is considered as broken.

  2. Install

    sudo apt-get install -f

    sudo apt-get install -f command tries to fix this broken package by installing the missing dependency.

Go back

cd -

History arrow down / arrow up alternative

ctrl + p
ctrl + n

Move one word left / right

alt + b 
alt + f

Delete symbol to the right / left from cursor

ctrl + d 
ctrl + h

Cut from cursor to start / end of the line

ctrl + u / ctrl + k

Cut word to the left from cursor

ctrl + w

Paste from buffer

ctrl + y

Watch logs

tail -f /var/log/httpd/access_log.2020-03-0*

List all local users

cut -d: -f1 /etc/passwd

Check if something running on specific port

apt install net-tools

netstat -plant | grep 443

lsof -i :80

CPU info

nproc

lscpu

Get and set user limits

ulimit -n

Benchmark server

sudo apt install apache2-utils -y

ab -n 100 -c 10 http://ip-address/