terminal commands

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,451
Hi. I need some pointers.
I am to be a system's administrator for an academic department. The computers have a dual boot system with mostly windows and ubuntu (opensuse on a few others).
My remote desktopping to windows is fine. I'd like to do the same with ubuntu; my ubuntu skills are putrid though.

Disclaimer: I've heard there's a uvnc version for linux, but i'm more interested in using putty/ssh terminal clients for now so's i can level my linux skills (after all thats where all the fun is;))


Terminal commands I need (ubuntu 10.10 and 9.04+ mostly):
-making user accounts:
just for username and passwords

-setting up connections for proxy servers:
a friend gave me a script, here's a portion.
sudo echo "Acquire::http:: Proxy \"http://user: pass@proxy server: port\";" > /etc/apt/apt.conf
I take it that, in the terminal, i just edit the apt.conf file with the above details?

-installing software:
if the above is correct (proxy server), i should, in theory, be able to do apt-get installations thru our proxy no probs (assuming my sources are sorted)?
also would it be possible to install programs from cds which use a gui during installation (afaik i wouldn't be entertained with a gui during ssh connections)?

For now, thats it. If anyone else has any other commands I may need to make my job easier I'm all ears.

Thanks
 

kim_bcs

Well-Known Member
Company Rep
Joined
Jan 14, 2011
Messages
152
sudo adduser username - to create a new user - Please read the manual page (man adduser) for more options, like adding a user to a specific group etc.

sudo deluser username - to delete a user

sudo passwd username - to change the password

I assume you mean that you will run that command in the terminal and it will add the line to the /etc/apt/apt.conf , cause then yes, you are right :)

Yes, although run apt-get update to make sure all the sources are fine.

Depends on what kind of things you will be doing, which commands might help you. Some useful tools are:

top - The top program provides a dynamic real-time view of a running system
free - free displays the total amount of free and used physical and swap mem‐
ory in the system
screen - Screen is a full-screen window manager that multiplexes a physical
terminal between several processes.
awk - mawk is an interpreter for the AWK Programming Language. The AWK lan‐
guage is useful for manipulation of data files, text retrieval and
processing, and for prototyping and experimenting with algorithms.
sed - Sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
grep
vim/vi/emacs
apt-get and aptitude
dpkg

you are going to have to become familiar and happy using bash and cli commands and tools. But again, it does really depend on what you are going to be doing. I would suggest that one of the most important aspects of being a sys admin on a linux system, is figuring out the file system structure and how the different parts of the system fit together. To keep an eye on the packages which are installed and to make sure that nothing gets installed without your say so.
 

kim_bcs

Well-Known Member
Company Rep
Joined
Jan 14, 2011
Messages
152
Thought of some more things that might be useful.

If the persons computer is having problems, you run top and find the rogue process which is causing all the issues:

strace -p process id

check what the heck the process is doing

if you feel confident that it should not be doing what it is doing

kill the process: kill process id

if that doesnt kill it, then kill -9 process id

To see if a service is running: ps -ef |grep service name

if you want to stop a service: /etc/init.d/service stop

if you want to start a service: /etc/init.d/service startif the service does not want to stop, then you will need to find the processes running for that service and kill them. Let us use apache as an example: ps -ef |grep apache
this should give you something like the following output:

root 5583 1 0 Jan15 ? 00:04:30 /usr/sbin/apache2 -k start
www-data 16596 5583 0 12:30 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 24046 5583 0 12:45 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 24781 5583 0 12:57 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 24815 5583 0 12:59 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25017 5583 0 13:01 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25079 5583 0 13:03 ? 00:00:03 /usr/sbin/apache2 -k start
www-data 25134 5583 0 13:05 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25514 5583 0 13:13 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25563 5583 1 13:15 ? 00:00:01 /usr/sbin/apache2 -k start
www-data 25564 5583 0 13:15 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25844 5583 0 13:17 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25845 5583 0 13:18 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 25846 5583 0 13:18 ? 00:00:00 /usr/sbin/apache2 -k start

Now, you want just the process id, so run: ps -ef |grep apache |awk '{print $2}'

5583
24046
24781
24815
25017
25079
25134
25514
25564
25845
25846
25901

Now, kill those basterds :) ps -ef |grep apache |awk '{print $2}' |xargs kill -9
 
Last edited:

battletoad

Expert Member
Joined
Mar 10, 2009
Messages
1,451
hectic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
lol but thanks, these will come in handy. was wondering about how i could see processes currently running on a remote pc...

was going to ask something else, but it seems so simple so i'll google that rather. besides, i'm going to have to read A LOT to get on the level don't I;)?
 
Last edited:

kim_bcs

Well-Known Member
Company Rep
Joined
Jan 14, 2011
Messages
152
Ask away, although google is a good tool. I will try to help answer any questions you have.

It does take time, but the amazing thing about Linux is that there are a huge amount of people willing to help. Makes it much easier when you get stuck. And of course, make sure you don't just copy and paste commands, but try to figure out what the commands are actually doing.
 

ozoned

Well-Known Member
Joined
Mar 30, 2010
Messages
269
-setting up connections for proxy servers:
a friend gave me a script, here's a portion.
Code:
sudo echo "Acquire::http:: Proxy \"http://user: pass@proxy server: port\";" > /etc/apt/apt.conf
I take it that, in the terminal, i just edit the apt.conf file with the above details?

Careful with that command, it will overwrite the contents of /etc/apt/apt.conf with the text in quotes.
You want to append the line I think, so use ">>" and not ">" in the redirection of output

I find htop a bit easier than top for beginners.
 

ponder

Honorary Master
Joined
Jan 22, 2005
Messages
92,823
There's always Webmin for the CLI challenged windows users.
 

w1z4rd

Karmic Sangoma
Joined
Jan 17, 2005
Messages
49,747
hectic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
lol but thanks, these will come in handy. was wondering about how i could see processes currently running on a remote pc...

was going to ask something else, but it seems so simple so i'll google that rather. besides, i'm going to have to read A LOT to get on the level don't I;)?

#ps -ax

To get process list.

#top

To see whats chowing the cpu
 

w1z4rd

Karmic Sangoma
Joined
Jan 17, 2005
Messages
49,747
It was only when I learnt how to combine linux commands that I realized how powerful linux is. | wtf!
 

Nod

Honorary Master
Joined
Jul 22, 2005
Messages
10,057
The best beginner manual you could use is the "Rute Manual".
It will show the most common commands, and much more.
 

kingmilo

Well-Known Member
Joined
Oct 26, 2009
Messages
130
I second Nod on this one. Also try your hand at installing Gentoo Linux www.gentoo.org , it's well documented and will teach you a hell of a lot.
 
Top