Command | Description |
whoami | outputs the username |
hostname | outputs the computer name |
ls -l | outputs the long list of directory |
man ls | Show manual |
cat /etc/issue | outputs the distribution and version (ubuntu) |
pwd | print working directory |
cd / | To navigate into the root directory |
cd or cd~ | To navigate to your home directory |
cd – | Navigate to previous directory |
rm -r directoryname | Remove directory (non-empty) |
clear | clear the screen |
./HelloApp | Run app |
stat file_name | details of the file |
cp source destination | Copy file |
cp –R * /app | Copy recursive all childs to /app destination |
find –name vcpu | find files |
vi …. :q! | vi editor and quit command |
df –h | Display file system, disk space usage (-h means human readable) |
type vi type mkdir type cd | Tells us where is command binary is or if it is shell built-in. (shell built-in: code for command included in shell, typically are faster and efficient). |
echo $PATH | Shows path environment variable. |
cat ~/.bash_history | outputs bash commands history |
history | output current command history |
env env | grep HIST | outputs environment variables. |
env | sort | more | output list of env variables alphabetically sorted and one page a time |
ls -l /etc | more | piping ls to a pager (more/less) |
du , du –sh | Disk usage of directory –s = summary, h = human readable |
free , free -m | Amount of free and used memory –m = MegaBytes |
ps | list running processes only which are owned by you and associated with current shell |
top | Table of processes running – to exit press q |
uname –a | Prints all system information |
cat /etc/lsb -release | Prints system information (ubuntu version) |
cat /proc/cpuinfo | Get CPU Info Using cat Command |
Ip addr | |
Ip a | |
Ifconfig | interface configurations, let you make changes to network interfaces eth0 = wired ethernet port wlan0 = wireless adapter MacAdress = it is listed next to the label “ether” |
nano abc.txt | open file in nano editor |
sudo nano abc.txt | susbstitute user do => performs actions as a different user and if u do not specify any user the default is root user, which is admin |
sudo reboot | To reboot the Linux system from a terminal session |
sudo cat /sys/class/dmi/id/board_serial | output board serial number |
jobs | output list of current shell jobs (each bash command is a job. Behind the scenes, shell fork itself, create a new process and execute the program code e.g. ls binary onto the new process stack ). Typically these shell commands are foreground jobs. |
ping 8.8.8.8 -c 5 > /tmp/pingfile & | The & sign in the end makes this command a background job. The command itself redirects the ping (google) 5 times output to a file. |
kill [PID] | terminate background job. PID is the id given by system when run the background job. |
cat /etc/passwd cat /etc/passwd | grep jawad | output login-shell info |
tty | shows which virtual console we are on. |
who | tells us who else is logged-in |
sudo addgroup hadoop sudo adduser –ingroup hadoop hadoop | Create a hadoop user and group hadoop. |
sudo su- hadoop | Switch user to the newly created hadoop user. |
tar -xzvf hadoop-3.3.0 sudo mv hadoop-3.3.0 /usr/local/hadoop | extract it, and move it to the appropriate usr/local folder |
sudo chown -R hadoop:hadoop usr/local/hadoop | Grant ownership of the folder to the hadoop user you created. |
apt get install wget | install wget package |
wget https://wordpress.org/latest.tar.gz | download wordpress website |
tar xzf latest.tar.gz | x: extract, z= unzip, f=filename immediately follows |
tar czf newabcarch.tar.gz abc/ | compress& zip abc folder (make tar file) |
cut -d: -f3 /etc/group | sort -n | text extraction: -d: (delimiter = colon : ), -f3 (field no. 3) |
Discover more from Hex Quote
Subscribe to get the latest posts sent to your email.