Solved

path to the homedirectory

Posted on 2011-03-22
9
433 Views
Last Modified: 2012-05-11
Hi, I need a script for it. The script should display the path to your homedirectory and the terminal type that you are using. Additionally it shows all the services started up in runlevel 3 on your system.

Thanks for advice.
0
Comment
Question by:zhshqzyc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 35196185
echo ~/ #home dir
echo $SHELL # shell used
echo $TERM #terminal type
echo `/sbin/runlevel` #to see which runlevel your system is running.
run_level=`/sbin/runlevel | awk ' { print $2 } '`
The services that run at run level 3 can be obtained using chkconfig --list
/sbin/chkconfig --list| awk ' ( $5 == "3:on") { print $1 } '
0
 

Author Comment

by:zhshqzyc
ID: 35198661
Everything is fine except this command.
run_level=`/sbin/runlevel | awk ' { print $2 } '`

Open in new window

Nothing found after running it.
0
 

Author Comment

by:zhshqzyc
ID: 35198689
And there is a hint.
ls /etc/rc3.d/S*

Open in new window

But I am not sure.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 78

Expert Comment

by:arnold
ID: 35198812
You can look at the Startup scripts in /etc/rc3.d as well.
what is the output of your /sbin/runlevel?
Do you have something like:
N 3

I am puzzled at your hint? Is there a purpose behind it?
In any event whether you use chkconfig or ls /etc/rc3.d/S* it says what based on startup script should start at this level, it does not tell you that some of those that are configured to start do not because those services were not configured i.e. /etc/<servicename>/<servicename>.conf was not created /setup
There is no reason a user logging into a system would need that type information.
0
 

Author Comment

by:zhshqzyc
ID: 35198906
It gave me
N 5

Open in new window

The hint is from a web tutorial. http://tille.garrels.be/training/bash/
I am doing a practice problem there.
0
 

Author Comment

by:zhshqzyc
ID: 35198919
[hzhao@localhost rc3.d]$ echo `/sbin/runlevel`N 5
[hzhao@localhost rc3.d]$ /sbin/chkconfig --list| awk ' ( $5 == "3:on") { print $1 } '
NetworkManager
abrtd
atd
auditd
avahi-daemon
bluetooth
cpuspeed
crond
cups
haldaemon
ip6tables
iptables
irqbalance
iscsi
iscsid
livesys
livesys-late
lvm2-monitor
mdmonitor
messagebus
netfs
portreserve
rsyslog
sendmail
udev-post
[hzhao@localhost rc3.d]$ 

Open in new window

0
 
LVL 78

Expert Comment

by:arnold
ID: 35198999
N 5 means you are running in graphical mode and if you want to check the services that start at that level, you should change the $5 in the awk with $7
0
 
LVL 78

Accepted Solution

by:
arnold earned 125 total points
ID: 35199008
Also change the comparisong from 3:on to 5:on.
/sbin/chkconfig --list| awk ' ( $7 == "5:on" ) { print $1 } '
0
 

Author Comment

by:zhshqzyc
ID: 35199101
Never mind, it is just a small exercise.hmm..
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
powershell backup 2 142
LINUX ZIP - UNCOMPRESS WINDOWS PATH 3 109
Call Shell Script from Perl Script 6 165
Powershell Timeout - Exchange 3 96
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question