Monday, February 22, 2021

Common Linux / Unix Commands

List Files 

ls

ls -la

ls -laSh

ls -laShr

ls -laS

ls -laShR

ls -lu


l - long listing

a - list all files including hidden, . and ..

A - don't show . and ..

S - sort by size

h - size in human readable format

r - sort in reverse order

R - list subdirectories recursively

u - sort alphabetically

Help on ls (or another command)

man ls

Create Directory

mkdir

Change to Path

cd path

Go up directory

cd ..

Update access date or create a file

touch fname 

Move a file

mv fname targetdir/fname

Copy a file

cp fname targetdir/fname

Delete a file

rm targetdir/fname

Delete a directory

rmdir targetdir

Edit file

nano fname

Download and save url content to disk

wget url

Reference: https://www.informit.com/articles/article.aspx?p=2858803&seqNum=2