Some basic commands of Linux

NomanProdhan

Familiar Face
Joined
May 16, 2015
Messages
94
Reaction score
4
FP$
279
I have just started using Linux for several days and trying my best to learn some commands 🙂
However, here I want to share some of the basic commands of Linux and I hope it will help newbies like me 🙂

ls (its small L not i)
The list command - functions in the Linux terminal to show all of the major directories filed under a given file system.
Example command :
ls ~/Downloads/
This command will show all the files/folder of Downloads directory.

cd
Change directory command will allow the user to change between file directories.
Example command :
cd /opt/softwares/
This command will change directory to /opt/softwares/ directory


mv
The mv command allows a user to move a file to another folder or directory.

Example command :
mv /opt/softwars/ /opt/apps/
This command will move softwares directory to apps directory.


We all know that there we have a lot of commands for Linux. I have just shared three. Feel free to share more here and lets make a big list of Linux command.
 
Avoid these commands:
sudo rm -rf / → Force remove everything.
sudo mv / /dev/null → Same as below.
sudo dd if=/dev/null of=/dev/sda → Make the entire "sda" partition blank.
sudo dd if=/dev/random of=/dev/sda → Replace all data of "sda" partition with garbage, and fill with garbage (also danger for HDD!).
sudo mkfs.ext4 /dev/sda → Delete existing partition, and create all new ext4 partition instead.
Code:
:(){:|:&};:
  ↓
Instant crash computer.
 
Avoid these commands:
sudo rm -rf / → Force remove everything.
sudo mv / /dev/null → Same as below.
sudo dd if=/dev/null of=/dev/sda → Make the entire "sda" partition blank.
sudo dd if=/dev/random of=/dev/sda → Replace all data of "sda" partition with garbage, and fill with garbage (also danger for HDD!).
sudo mkfs.ext4 /dev/sda → Delete existing partition, and create all new ext4 partition instead.
Code:
:(){:|:&};:
  ↓
Instant crash computer.
Most systems will not permit sudo rm -rf / because it is the root of the system. You'd have to specify --no-preserve-root, but regardless this is a good tip. If you're on a Linux system and you need to remove a file, don't add the -rf switches unless 1) it's a directory, then add -r and 2) want to skip verification, then add -f (together as -rf). Be careful at all times.

Always be wary of anything routing to /dev/null unless it's for good reason (log output in cron job, etc). A good thing to note is that you only ever want to mv if you're moving specific files or directories, never execute an mv on a mount point (/, /boot, /home, etc).

The rest of the commands will only apply if the sda device exists, sda is not a partition but a container that holds partitions... hence, I'm not sure if dd will accept that execution, though it might. One would need to specify the partition using its numerical id (i.e, sda1). As always dd and mkfs are parts of manual partitioning and should only be used by an experienced system administrator.

Code:
:(){:|:&};:
is a fork-bomb. You can look these up. They cause the computer to continuously spawn processes until it crashes. It is not instant, it could take a while, but it is dangerous and could even cause heat damage in some cases of a badly ventilated unit.
 
Back
Top Bottom