Linux Command Cheat Sheet Share This Cheat Sheet

Linux Command Cheat Sheet

Basic commands

Share This Cheat Sheet

File management

File Utilities

|

Pipe (redirect) output

?nd

search for a ?le

tr -d

translate or delete character

sudo [command]

run < command> in superuser

mode

ls -a -C -h

list content of directory

uniq -c -u

report or omit repeated lines

rm -r -f

remove ?les and directory

split -l

split ?le into pieces

locate -i

?nd ?le, using updatedb(8)

database

wc -w

print newline, word, and byte

counts for each ?le

cp -a -R -i

copy ?les or directory

head -n

output the ?rst part of ?les

du -s

disk usage

cut -s

remove section from ?le

?le -b -i

identify the ?le type

di? -q

?le compare, line by line

mv -f -i

move ?les or directory

join -i

grep, egrep, fgrep -i -v

print lines matching pattern

nohup [command]

run < command> immune to

hangup signal

man [command]

display help pages of

< command>

[command] &

run < command> and send task

to background

>> [?leA]

append to ?leA, preserving

existing contents

> [?leA]

output to ?leA, overwriting

contents

echo -n

display a line of text

xargs

build command line from

previous output

File compression

tar xvfz

create or extract .tar or .tgz

?les

1>2&

Redirect stdout to stderr

fg %N

go to task N

gzip, gunzip, zcat

create, extract or view .gz ?les

jobs

list task

uuencode, uudecode

create or extract .Z ?les

ctrl-z

suspend current task

zip, unzip -v

create or extract .ZIP ?les

rpm

create or extract .rpm ?les

bzip2, bunzip2

create or extract .bz2 ?les

File permission

chmod -c -R

chmod ?le read, write and

executable permission

touch -a -t

modify (or create) ?le timestamp

chown -c -R

change ?le ownership

chgrp -c -R

change ?le group permission

touch -a -t

modify (or create) ?le

timestamp

Network

netstat -r -v

print network information,

routing and connections

telnet

user interface to the TELNET

protocol

tcpdump

dump network tra?c

ssh -i

openSSH client

ping -c

print routing packet trace to

host network

Compiled by Alvin Khoo

rar

create or extract .rar ?les

File Editor

ex

basic editor

vi

visual editor

nano

pico clone

view

view ?le only

emacs

extensible, customizable editor

Memory & Processes

free -m

display free and used system

memory

killall

stop all process by name

sensors

CPU temperature

top

display current processes, real

time monitoring

kill -1 -9

send signal to process

service

[start|stop|restart]

manage or run sysV init script

join lines of two ?les on a

common ?eld

ps aux

display current processes,

snapshot

more, less

view ?le content, one page at a

time

dmesg -k

display system messages

sort -n

sort lines in text ?le

comm -3

compare two sorted ?les, line

by line

cat -s

concatenate ?les to the

standard output

tail -f

output last part of the ?le

Scripting

Disk Utilities

df -h, -i

File system usage

mkfs -t -V

create ?le system

resize2fs

update a ?lesystem, after

lvextend*

fsck -A -N

?le system check & repair

pvcreate

create physical volume

awk, gawk

pattern scanning

mount -a -t

mount a ?lesystem

tsh

tiny shell

fdisk -l

edit disk partition

""

anything within double quotes

is unchanged except \ and $

lvcreate

create a logical volume

umount -f -v

umount a ?lesystem

''

anything within single quote is

unchanged

python

"object-oriented programming

language"

bash

GNU bourne-again SHell

ksh

korn shell

php

general-purpose scripting

language

Misc Commands

pwd -P

print current working directory

bc

high precision calculator

expr

evaluate expression

sublime

yet another text editor

sed

stream editor

csh, tcsh

C shell

cal

print calender

pico

simple editor

perl

Practical Extraction and Report

Language

export

assign or remove environment

variable

source [?le]

load any functions ?le into the

current shell, requires the ?le

to be executable

` [command]

backquote, execute command

date -d

print formatted date

$[variable]

if set, access the variable

Directory Utilities

mkdir

create a directory

rmdir

remove a directory

Read the Blog Post ?

bit.ly/Linux-Commands

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download