| command | description |
|---|---|
| ls | list files and directories |
| cd | change directory |
| pwd | print current working directory |
| mkdir | create a new directory |
| rm | remove files and directories |
| cp | copy files and directories |
| mv | move/rename files and directories |
| touch | create an empty file or update file timestamps |
| cat | view the contents of a file |
| head | display the first few lines of a file |
| tail | display the last few lines of a file |
| ln | create links between files |
| find | search for files and directories |
| command | description |
|---|---|
| chmod | change file permissions |
| chown | change file ownership |
| chgrp | change group ownership |
| umask | set default file permissions |
| command | description |
|---|---|
| tar | Create or extract archive files |
| gzip | Compress files |
| zip | Create compressed zip archives |
| command | description |
|---|---|
| ps | Display running processes |
| top | Monitor system processes in real-time |
| kill | Terminate a process |
| pkill | Terminate processes based on their name |
| pgrep | List processes based on their name |
| grep | used to search for specific patterns or regular expressions in text files or streams and display matching lines |
| command | description |
|---|---|
| uname | Print system information |
| whoami | Display current username |
| df | Show disk space usage |
| du | Estimate file and directory sizes |
| free | Display memory usage information |
| uptime | Show system uptime |
| lscpu | Display CPU information |
| lspci | List PCI devices |
| lsusb | List USB devices |
| command | description |
|---|---|
| ifconfig | Display network interface information |
| ping | Send ICMP echo requests to a host |
| netstat | Display network connections and statistics |
| ss | Display network socket information |
| ssh | Securely connect to a remote server |
| scp | Securely copy files between hosts |
| wget | Download files from the web |
| curl | Transfer data to or from a server |
| command | description |
|---|---|
| cmd < file | Input of cmd is taken from file |
| cmd > file | Standard output (stdout) of cmd is redirected to file |
| cmd 2> file | Error output (stderr) of cmd is redirected to file |
| cmd 2>&1 | stderr is redirected to the same place as stdout |
| cmd1 <(cmd2) | Output of cmd2 is used as the input file for cmd1 |
| cmd > /dev/null | Discards the stdout of cmd by sending it to the null device |
| cmd &> file | Every output of cmd is redirected to file |
| cmd 1>&2 | stdout is redirected to the same place as stderr |
| cmd >> file | Appends the stdout of cmd to file |
| command | description |
|---|---|
| export VARIABLE_NAME=value | Sets the value of an environment variable |
| echo $VARIABLE_NAME | Displays the value of a specific environment variable |
| env | Lists all environment variables currently set in the system |
| unset VARIABLE_NAME | Unsets or removes an environment variable |
| export -p | Shows a list of all currently exported environment variables |
| env VAR1=value COMMAND | Sets the value of an environment variable for a specific command |
| printenv | Displays the values of all environment variables |
| command | description |
|---|---|
| who | Show who is currently logged in |
| sudo adduser username | Create a new user account on the system with the specified username |
| finger | Display information about all the users currently logged into the system, including their usernames, login time, and terminal |
| sudo deluser USER GROUPNAME | Remove the specified user from the specified group |
| last | Show the recent login history of users |
| finger username | Provide information about the specified user, including their username, real name, terminal, idle time, and login time |
| sudo userdel -r username | Delete the specified user account from the system, including their home directory and associated files. The -r option ensures the removal of the user’s files |
| sudo passwd -l username | Lock the password of the specified user account, preventing the user from logging in |
| su - username | Switch to another user account with the user's environment |
| sudo usermod -a -G GROUPNAME USERNAME | Add an existing user to the specified group. The user is added to the group without removing them from their current groups |
| command | description |
|---|---|
| Ctrl + A | Move to the beginning of the line |
| Ctrl + E | Move to the end of the line |
| Ctrl + B | Move back one character |
| Ctrl + F | Move forward one character |
| Alt + B | Move back one word |
| Alt + F | Move forward one word |
| command | description |
|---|---|
| Ctrl + U | Cut/delete from the cursor position to the beginning of the line |
| Ctrl + K | Cut/delete from the cursor position to the end of the line |
| Ctrl + W | Cut/delete the word before the cursor |
| Ctrl + Y | Paste the last cut text |
| Ctrl + L | Clear the screen |
| command | description |
|---|---|
| Ctrl + R | Search command history (reverse search) |
| Ctrl + G | Escape from history search mode |
| Ctrl + P | Go to the previous command in history |
| Ctrl + N | Go to the next command in history |
| Ctrl + C | Terminate the current command |
from sense_hat import SenseHat
sense = SenseHat()
from sense_hat import SenseHat
sense = SenseHat()
# Temperature
temp = sense.get_temperature()
print("Temperature: %s C" % temp)
from sense_hat import SenseHat
sense = SenseHat()
# Humidity
humidity = sense.get_humidity()
print("Humidity: %s %%" % humidity)
from sense_hat import SenseHat
sense = SenseHat()
# Pressure
pressure = sense.get_pressure()
print("Pressure: %s Millibars" % pressure)