Raspbian command

AJA • March 19, 2020

raspberry

Here are some fundamental and common Linux commands with example usage.

df

Use df to display the disk space available and used on the mounted filesystems. Use df -h to see the output in a human-readable format using M for MBs rather than showing number of bytes.

wget

Download a file from the web directly to the computer with wget. So wget https://www.raspberrypi.org/documentation/linux/usage/commands.md will download this file to your computer.

nmap

nmap is a network exploration and scanning tool. It can return port and OS information about a host or a range of hosts. Running just nmap will display the options available as well as example usage.

hostname

The hostname command displays the current hostname of the system. A privileged (super) user can set the hostname to a new one by supplying it as an argument (e.g. hostname new-host).

ifconfig

Use ifconfig to display the network configuration details for the interfaces on the current system when run without any arguments (i.e. ifconfig). By supplying the command with the name of an interface (e.g. eth0 or lo) you can then alter the configuration: check the manual page for more details.

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.85 netmask 255.255.255.0 broadcast 192.168.1.255

blkid

It can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).

sudo blkid

/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="9969-E3D2" TYPE="vfat" PARTUUID="97709164-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="8f2a74a4-809c-471e-b4ad-a91bfd51d7c3" TYPE="ext4" PARTUUID="97709164-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="9969-E3D2" TYPE="vfat" PARTUUID="d33dd34f-01"
/dev/sda2: LABEL="rootfs" UUID="8f2a74a4-809c-471e-b4ad-a91bfd51d7c3" TYPE="ext4" PARTUUID="d33dd34f-02"
/dev/mmcblk0: PTUUID="97709164" PTTYPE="dos"

apt-get update

Use apt-get update to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list.

apt-get dist-upgrade

Use dist-upgrade to install the newest versions of all packages currently installed on the system and also intelligently handles changing dependencies with new versions of packages.

piwiz

Use piwiz to run again the Raspberry setup wizard.

scrot -s

Use scrot -s to take screenshot interactively selecting a windows or rectangle.

activate VNC