Linux Command Line Guide

ยท 389 words ยท 2 minute read

This guide is heavely based on Oliver Eliott’s 100 Useful Command-Line Utilities

l s ๐Ÿ”—

l s dash l

long form

l s dash h l

long form human readable

l s dash h l t

long form human readable sorted by time

l s dash a l

list all including dot files and directories.

mkdir ๐Ÿ”—

m k d i r dash p a slash b slash c

make nested directories

echo ๐Ÿ”—

echo dash n joe

suppress newline

echo dash e joe backslash t joe backslash n joe

interpret special charaters

if you want to print a string with spaces, use quotes.

If you use double quotes, any variable inside them will be expanded.

If you use single quotes, everything is taken literally and variables are not expanded.

cat ๐Ÿ”—

cat dash n files.txt

print file with line numbers

dash vet flag allows us to see special charaters

cp ๐Ÿ”—

c p dash R dir1 dir2

copy directories

mv ๐Ÿ”—

Change the extension of a file, test.txt from .txt to .html

m v test dot open curly bracket txt comma html closing curly bracket

m v dash n my file my dir slash

move unless my file exists in my dir

shred ๐Ÿ”—

shred dash z u v file

head ๐Ÿ”—

head my file text

print the first 10 lines of the file

tail ๐Ÿ”—

tail my file text

print the last 10 lines of the file

cat dash n file text pipe head dash 37 pipe tail dash 1

print row 37

less ๐Ÿ”—

less dash s my file text

allow horizontal scrolling

grep egrep ๐Ÿ”—

grep dash n apple my file text

include the line number

which ๐Ÿ”—

chmod ๐Ÿ”—

chown ๐Ÿ”—

history ๐Ÿ”—

clear ๐Ÿ”—

logout ๐Ÿ”—

exit ๐Ÿ”—

sudo ๐Ÿ”—

su ๐Ÿ”—

wc ๐Ÿ”—

sort ๐Ÿ”—

ssh ๐Ÿ”—

ssh-keygen ๐Ÿ”—

scp ๐Ÿ”—

rsync ๐Ÿ”—

source ๐Ÿ”—

export ๐Ÿ”—

ln ๐Ÿ”—

readlink ๐Ÿ”—

git ๐Ÿ”—

sleep ๐Ÿ”—

ps ๐Ÿ”—

pstree ๐Ÿ”—

jobs ๐Ÿ”—

bg ๐Ÿ”—

fg

kill

top

htop

nohup

time

seq

cut

paste

awk

sed

date

cal

gzip

gunzip

bzip2

bunzip2

tar

uniq

dirname

basename

set

unset

env

uname

df

du

bind

alias

unalias

column

find

touch

diff

comm

join

md5

md5sum

tr

od

split

nano

emac

vim

tree

screen

tmux

make

yes

nl

whoami

groups

who

w

hostname

finger

read

tee

shopt

true

false

shift

g++

xargs

crontab

type

info

apropos

fold

rev

mount

mktemp

watch

perl

python

ping

dig

ifconfig

wget

elink

curl

apt-get

brew

yum

display

convert

identify

gpg

datamash

virtualenv

lsof

Global Variables

Network Analysis