JORDAN CAMPBELL
R&D SOFTWARE ENGINEER
cybernaut/0.1.4

These are a few basic commands that I use all the time but seemingly never remember.

List files in a directory

$ ls -lah

Search for a particular symbol in a static library

$ nm lib.a | grep 'symbol'

Show the sizes of all directories and files in the current directory

$ du -hc -d 1

Find a file

$ find . -name 'filename'

Get process running on port

$ lsof -i tcp:'port'

Kill process running on port

$ kill -9 'pid'

Create multiple directories at once

$ mkdir -p root/{a/b,c,d,e/{f,g,h},i/j}
.
└── root
    ├── a
    │   └── b
    ├── c
    ├── d
    ├── e
    │   ├── f
    │   ├── g
    │   └── h
    └── i
        └── j
    

Loop over files by glob

$ for filename in *.txt; do echo $filename; done