Skip to content

Instantly share code, notes, and snippets.

@rossant
Last active August 29, 2015 14:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rossant/5f5049f3b06598d0952b to your computer and use it in GitHub Desktop.
Save rossant/5f5049f3b06598d0952b to your computer and use it in GitHub Desktop.
Useful Linux commands (tested on Ubuntu 14.04)

Useful Linux commands

Check drive speed

Read

sudo hdparm -t /dev/sda

Write and read (need 1GB free space)

dd if=/dev/zero of=_speedtest bs=512000 count=2048 && dd if=_speedtest of=/dev/null bs=512000 && rm _speedtest

List drive partitions

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

Reboot and shutdown

Shutdown

sudo shutdown -h now

Reboot

sudo reboot

Sleep

sudo pm-suspend

Network

Get Ethernet card info

sudo ethtool eth0

Enable wake-on-lan

sudo ethtool -s eth0 wol g

Wake on lan

wakeonlan -i <ip> <mac-address>

Check Ethernet speed

iperf -s
iperf -c <ip>

Copy folder to SSH machine

rsync -az from/ login@host:/to/

File system

Symbolic link

ln -s <from> <to>

Tasks

Execute commands on startup

/etc/rc.local

With crontab:

sudo crontab -e
# and put at the end:
@reboot mycommand &

Misc

Clear crash log

sudo rm /var/crash/*

Linux version

uname -a

Enable up arrow completion in bash

# to put in ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward

Process info

ps aux | grep <name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment