PentOpsVault @syztem4our666

PentOpsVault
Linux

One Liners

Linux oneliners

Run the last command as root

sudo !!

Serve current directory tree at http://$HOSTNAME:8000/

python -m SimpleHTTPServer

Runs previous command but replacing

^foo^bar

Rapidly invoke an editor to write a long, complex, or tricky command

ctrl-x e

Place the argument of the most recent command on the shell

'ALT+.' or '<ESC> .'

Currently mounted filesystems in nice layout

mount | column -t

Salvage a borked terminal

reset

Get your external IP address

curl ifconfig.me

Execute a command at a given time

echo "ls -l" | at midnight

Quick access to the ascii table

man ascii

Output your microphone to a remote computer's speaker

dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp

Type partial command, kill this command, check something you forgot, yank the command, resume typing

<ctrl+u> [...] <ctrl+y>

Query Wikipedia via console over DNS

dig +short txt <keyword>.wp.dg.cx

Mount folder/filesystem through SSH

sshfs name@server:/path/to/folder /path/to/mount/point

Mount a temporary ram partition

mount -t tmpfs tmpfs /mnt -o size=1024m

Download an entire website

wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com

Clear the terminal screen

ctrl-l

Compare a remote file with a local file

ssh user@host cat /path/to/remotefile | diff /path/to/localfile -

SSH connection through host in the middle

ssh -t reachable_host ssh unreachable_host

Update Twitter via curl

curl -u user:pass -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml

A very simple and useful stopwatch

time read (ctrl-d to stop)

Put a console clock in top right corner

while sleep 1; do tput sc; tput cup 0 $(($(tput cols)-29)); date; tput rc; done &

Make 'less' behave like 'tail -f'

less +F somelogfile

Close shell keeping all subprocess running

disown -a && exit

Watch Star Wars via telnet

telnet towel.blinkenlights.nl

32 bits or 64 bits?

getconf LONG_BIT

List of commands you use most often

history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head

Simulate typing

echo "You can simulate on-screen typing just like in the movies" | pv -qL 10

Set audible alarm when an IP address comes online

ping -i 60 -a IP_address

Reboot machine when everything is hanging

<alt> + <print screen/sys rq> + <R> - <S> - <E> - <I> - <U> - <B>

Quickly rename a file

mv filename.{old,new}

Display the top ten running processes - sorted by memory usage

ps aux | sort -nk +4 | tail

Delete all files in a folder that don't match a certain file extension

rm !(*.foo|*.bar|*.baz)

Push your present working directory to a stack that you can pop later

pushd /tmp

Create a script of the last executed command

echo "!!" > foo.sh

Watch Network Service Activity in Real-time

lsof -i

Easy and fast access to often executed commands that are very long and complex

some_very_long_and_complex_command # label

Escape any command aliases

\[command]

Show apps that use internet connection at the moment (Multi-Language)

lsof -P -i -n

Diff two unsorted files without creating temporary files

diff <(sort file1) <(sort file2)

Reuse all parameters of the previous command line

!*

On this page

Run the last command as rootServe current directory tree at http://$HOSTNAME:8000/Runs previous command but replacingRapidly invoke an editor to write a long, complex, or tricky commandPlace the argument of the most recent command on the shellCurrently mounted filesystems in nice layoutSalvage a borked terminalGet your external IP addressExecute a command at a given timeQuick access to the ascii tableOutput your microphone to a remote computer's speakerType partial command, kill this command, check something you forgot, yank the command, resume typingQuery Wikipedia via console over DNSMount folder/filesystem through SSHMount a temporary ram partitionDownload an entire websiteClear the terminal screenCompare a remote file with a local fileSSH connection through host in the middleUpdate Twitter via curlA very simple and useful stopwatchPut a console clock in top right cornerMake 'less' behave like 'tail -f'Close shell keeping all subprocess runningWatch Star Wars via telnet32 bits or 64 bits?List of commands you use most oftenSimulate typingSet audible alarm when an IP address comes onlineReboot machine when everything is hangingQuickly rename a fileDisplay the top ten running processes - sorted by memory usageDelete all files in a folder that don't match a certain file extensionPush your present working directory to a stack that you can pop laterCreate a script of the last executed commandWatch Network Service Activity in Real-timeEasy and fast access to often executed commands that are very long and complexEscape any command aliasesShow apps that use internet connection at the moment (Multi-Language)Diff two unsorted files without creating temporary filesReuse all parameters of the previous command line
Edit on GitHub