"terminal Fear"


mindlord

Notices Two Things
Joined
Mar 10, 2006
Messages
1,786
Location
In a cave.
Website
Visit site
Friends, Romans, Linux Noobs! I see the topic of "terminal fear" popping up about every two weeks. Usually embedded in other topics. Rest assured, if and when an end user is put into the "unholy" position of opening a Linux terminal to do something. You're not going to be out there all alone with no guidance. Odds are if you're popping open a terminal for the first time on the Pandora it's because you're doing some "magic-hackery" or accessing a feature that's not quite ready yet. The most you'll every have to do is open the terminal, type a command exactly as is says on the wiki or what the friendly guru told you here in the forums or on IRC, and press enter. In general you won't be using the terminal to move or copy files, modify text configurations, or anything like that. There are GUI file managers and powerful text editors for those tasks. You CAN do those things in a terminal, but you don't have to.

For some it might help to think of the Terminal like a command console in a game like Quake, TES4:Oblivion, Fallout 3, or whatever. With a little knowledge and guidance you can enter cheat codes (commands) that affect how your Pandora behaves. It really is that simple most of the time.

If you feel inclined to learn what that cryptic command does specifically, that's up to you. As long as you trust the information, and you're ok taking another guys word that the solution to your problem is to type a command like this:
Code:
sudo ln -s /usr/lib/openGLes.so.4 /usr/lib/openGLes.so.3
You've got nothing to worry about. This type of solution appears in the Ubuntu forums all the time, and Ubuntu is more or less considered the most noob friendly Linux out there. Hell, even in windows stuff like this happens! I work as a phone support tech for an ISP. I can't tell you how many times I've had to get a person running Vista to open up a terminal in Administrator mode to enter the command:
Code:
netsh int ip reset reset.log
How is that any less unholy and archaic than what I exampled for Linux?

The Linux terminal is not some Pandora's Box (See what I did there? ;) ) that once opened can't be closed. Linux takes great care to ensure that you don't damage sensitive parts of the operating system when you're running as your normal user account. You can only affect files in your home directory, and you can't accidentally overwrite or delete critical operating system files without consciously giving yourself permission to do so. There is no magic button combination that you can accidentally press that will destroy your Pandora once and for all. That's not to say that once can't give themselves root/superuser/administrator powers and wreak havoc, but as long as you're careful nothing bad is going to happen.

In general, if you're following instructions and a command starts with "sudo" (Super User DO) take a deep breath, type very carefully, and double check your spelling and punctuation. While not every command that needs Super User power is particularly dangerous. Some can be. You should also trust your source, but that goes without saying. Truthfully, this is even less dangerous than the Windows Command Prompt which does nothing to stop a non-administrator user from deleting huge swaths of the file-system if they feel so inclined.

Learning to use the Terminal in Linux is a great benefit to any end user. It grants them to power to fix problems that otherwise couldn't be fixed with strapped in a GUI. A fine example. The GUI is completely locked up. You can move the mouse, but nothing responds. In Windows, what can you do? Reboot? That's about it. In Linux, you can hit Alt-Ctrl-F1 and drop to a terminal at any time. Log in, and issue the command:
Code:
sudo /etc/init.d/slim-init restart
Hokus-Cadabra! In 5 seconds you've got X running again. Note: this command is for the Pandora, other versions of Linux will use gdm, kdm, xdm or something else entirely instead of slim-init. This is just one simple scenario where shedding the "Terminal Fear" can save you a whole bunch of time.

There are literally thousands of "cheat codes" to try in Linux. Once you get the hang of "cheat codes" you can easily pick up more advanced commands, and even writing scripts. Before you know it you'll be fearlessly issuing terminal commands in Linux and wondering how you ever got along without them before.

Thanks for listening.

Edit: Spelling and to thank dflemstr for pointing out my gdm restart error.
Edit: Replaced the gdm specific command for restarting X with EvilDragon's information.
 
^ Well said. I can agree from my own experiences, as we all started as noobs at some point. Some of us still are compared to many others
smile.gif
.
 

Attachments

  • smile.gif
    smile.gif
    699 bytes · Views: 168
Last edited by a moderator:
I've been using Linux since Windows 2000 was out, before Windows Me, and when I was new I used the terminal all the time. Now-a-days I use it maybe once a week, maybe a few times, there is a GUI for everything now. About the only thing I use the terminal for now is renaming files, like when I want to put a space in the name of every file in a directory or change every file from caps to lowercase. One command does it all, beats the heck out of right clicking every file and renaming it by hand in the gui especially when there are 100+ files. I do that so infrequently that I need to look it up every time I do it.

Seriously, its almost to the point where you use the terminal in Linux as much as you use the DOS prompt in Windows.
 
"cheat codes", nice :)

watch a video. Play music. Fire up a pnd game. Browse web .. None of thisneeds command line!

Jeff
 
.. just don't try the atomicthumbs command and you'll be fine.
 
I'm not trying to be argumentative or anything, but sometimes it does help to know the basics. If you get into a jam, or if X goes down, and you need to fix your machine, knowing some basic commands can really help a lot.

If the X server dies, and you'd like to have it back
Code:
startx

Change directories
Code:
cd <path to move to>

Change directories to one above current
Code:
cd ..

Check the current directory
Code:
pwd

List files in current directory
Code:
ls

List all files in current directory (including hidden)
Code:
ls -a

Copy files and directories (copy/paste)
Code:
cp -rf <from> <to>

Move files and directories (cut/paste)
Code:
mv <from> <to>

Delete files and directories (probably kinda dangerous)
Code:
rm -rf <file>

Untar file with .tar.gz
Code:
tar -xzvf <file.tar.gz>

Untar file with .tar.bz2
Code:
tar -xjvf <file.tar.bz2>

Tar a directory
Code:
tar -czvf <file.tar.gz> <Directory>

Run an executable in current directory
Code:
./<file>

Run an executable in PATH
Code:
<file>

List tasks
Code:
ps -ef

Look for specific task
Code:
ps -ef | grep <search name>

Kill a task get PID from above command
Code:
kill <PID>

If task is still running, and it really needs to be killed (don't do this unless you need to)
Code:
kill -9 <PID>

Find a file
Code:
find / -name <file>

View a file (not edit) - 'q' to quit, '/<term>' to search, 'n' for next search result
Code:
less <file>

View system messages - 'q' to quit, '/<term>' to search 'n' for next search result (as root)
Code:
dmesg | less

Reboot the system (as root)
Code:
reboot

A few text editors (maybe pick one):
vim
emacs
nano (easiest?)
joe
 
emil10001 said:
I'm not trying to be argumentative or anything, but sometimes it does help to know the basics. If you get into a jam, or if X goes down, and you need to fix your machine, knowing some basic commands can really help a lot.

If the X server dies, and you'd like to have it back
Code:
startx

Change directories
Code:
cd <path to move to>

Change directories to one above current
Code:
cd ..

Check the current directory
Code:
pwd

List files in current directory
Code:
ls

List all files in current directory (including hidden)
Code:
ls -a

Copy files and directories (copy/paste)
Code:
cp -rf <from> <to>

Move files and directories (cut/paste)
Code:
mv <from> <to>

Delete files and directories (probably kinda dangerous)
Code:
rm -rf <file>

Untar file with .tar.gz
Code:
tar -xzvf <file.tar.gz>

Untar file with .tar.bz2
Code:
tar -xjvf <file.tar.bz2>

Tar a directory
Code:
tar -czvf <file.tar.gz> <Directory>

Run an executable in current directory
Code:
./<file>

Run an executable in PATH
Code:
<file>

List tasks
Code:
ps -ef

Look for specific task
Code:
ps -ef | grep <search name>

Kill a task get PID from above command
Code:
kill <PID>

If task is still running, and it really needs to be killed (don't do this unless you need to)
Code:
kill -9 <PID>

Find a file
Code:
find / -name <file>

View a file (not edit) - 'q' to quit, '/<term>' to search, 'n' for next search result
Code:
less <file>

View system messages - 'q' to quit, '/<term>' to search 'n' for next search result (as root)
Code:
dmesg | less

Reboot the system (as root)
Code:
reboot

A few text editors (maybe pick one):
vim
emacs
nano (easiest?)
joe
I had a really good page that had a lot of useful terminal commands on it but I seem to have lost it on a bookmarks purge. Maybe someone should link a good site for commands and explanations. You got pretty much all the important stuff covered though.
 
Last edited by a moderator:
second exodous said:
I had a really good page that had a lot of useful terminal commands on it but I seem to have lost it on a bookmarks purge. Maybe someone should link a good site for commands and explanations. You got pretty much all the important stuff covered though.

Yea, I just wanted to cover the basics. If the UI freezes up, it's nice to have somewhere to go. I have a couple favorite reference, but they are in book form. O'Reilly's "Linux Pocket Guide" is pretty good for just covering the commands. The man pages are also a good resource, and usually available even if nothing else is.

Learn more about a command (man as in manual)
Code:
man <command>
 
Last edited by a moderator:
dflemstr said:
mindlord said:
Log in, and issue the command:
Code:
sudo /etc/init.d/restart gdm
Err, I think you mean "sudo /etc/init.d/gdm restart"

Otherwise, a +1 to you in general.
Eep. You're right. I'll fix it. Can't believe I missed that since I proofread the post like 5 times.
 
Last edited by a moderator:
emil10001 said:
I'm not trying to be argumentative or anything, but sometimes it does help to know the basics. If you get into a jam, or if X goes down, and you need to fix your machine, knowing some basic commands can really help a lot.

Oh, no. I completely agree. In fact at the end of the post I encourage the reader to explore and learn the specifics. It is not nearly as critical for a Pandora (or any Linux user) nowadays to learn all the terminal commands. It is extremely useful to do so, though.
 
Last edited by a moderator:
Tor said:
.. just don't try the atomicthumbs command and you'll be fine.

I'm still such a noob...

Doesn't that say he's going to concatenate the data stored in RAM to the first partition on the first disk but not to a named file? That doesn't make much sense...?
 
Last edited by a moderator:
Grench said:
Tor said:
.. just don't try the atomicthumbs command and you'll be fine.

I'm still such a noob...

Doesn't that say he's going to concatenate the data stored in RAM to the first partition on the first disk but not to a named file? That doesn't make much sense...?
Exactly.
The command will overwrite the contents of your drive with a RAM dump. Doesn't make much sense, but neither does "sudo rm -rf /" or "sudo rm /boot/*" or "rmmod -f usbhid" or any of those strange commands,
 
Last edited by a moderator:
All all of that is why you should trust your source. Just like Windows users should never "format -U -Q" or "deltree Windows" etc. The real risk of using the Terminal is not taking to time to research what you're doing. With the exception of Atomicthumbs here, possibly a few others. I think this community won't steer you into a brick wall.
 
Mindlord, thanks for the reassurance.
Like myself, I think there are (will be) alot of people coming from the windows' world.
I must admit, when I hear Linux, I do think about cryptic commands issued in terminals.
I do hope to learn more about Linux once I get the Pandora.
 
dflemstr said:
"rmmod -f usbhid"
This can actually be useful. I've had instances where my USB did funny things and the fastest way to fix it was to unload/reload the module.
Just make sure you have a non-USB keyboard when you do it :p
 
Last edited by a moderator:
Just to nitpick a bit, '-' isn't needed for the 'tar' options.
I.e. 'tar xvf file.tar' is OK, it isn't necessary to enter 'tar -xvf file.tar'. It's a bit non-standard in that sense, but a keypress saved is a keypress saved.
 
mindlord said:
dflemstr said:
mindlord said:
Log in, and issue the command:
Code:
sudo /etc/init.d/restart gdm
Err, I think you mean "sudo /etc/init.d/gdm restart"

Otherwise, a +1 to you in general.
Eep. You're right. I'll fix it. Can't believe I missed that since I proofread the post like 5 times.

Well, except for that there's no gdm on the Pandora. Would be way too huge and slow :)
We're using slim, so the correct command would be:

sudo /etc/init.d/slim-init restart
 
Last edited:
EvilDragon said:
Well, except for that there's no gdm on the Pandora. Would be way too huge and slow :)
We're using slim, so the correct command would be:

sudo /etc/init.d/slim-init restart
Can you Alt-Ctrl-F1 on the Pandora? Is it Alt-Ctrl-Fn-1? Does that even work?
 
Last edited by a moderator:
Back
Top