Useful linux commands in console

From Urandom
Jump to navigation Jump to search
  • htop

For process viewing purposes

  • iotop

For disc activity

  • mc

File manager(can do FTP and SAMBA)

  • du -sh *

For calculating directory sizes recursively.

  • ssh -R port:host:hostport

If you need to get somewhere that has no open ports. Then you just connect to the local "port" and it will be tunneld to the "hostport" over ssh.

  • df -h

View disc sizes

  • free -m

View free memory

  • cat /proc/cpuinfo

View information about the processors.

  • lspci

To see what PCI hardware we have

  • lshw

To see lots of information about the hardware(has also gtk-lshw with GUI)

  • alsamixer

Control volumes

  • chroot /mnt/root /bin/bash

Chroot into a machine, for example when someone forgot the password you can boot a live-cd mount the root FS to /mnt/root and chroot into it and change the password. Or if you scre up the kernel and can't boot.

  • gpasswd -a USER GROUP

Add a user to the group.

  • nslookup IP|HOST

If you need to get the hostname by ip or ip by hostname, this is the thing to do.

  • ./some_program >> /dev/null 2>&1

Send all output to /dev/null, meaning to disable all output.