Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

directory problem in redhat 9

Hi

when i login to my redhat 9 box and do "ls -l" it does'nt show me any directory and when i remotely login using ssh and try the following it showes me all the directories and everything works fine. please help me out what's wrong
0
lomaree
Asked:
lomaree
  • 9
  • 6
  • 2
1 Solution
 
karlwilburCommented:
I am not sure what you mean here.  Are you saying that when you login at the on the console you don't see the directory names, or is it that you see the directory names but the directories are not blue(or whatever color you expect them to be).  What do you see when you login at the console?

-Karl
0
 
lomareeAuthor Commented:
i mean that when i login i don't see directory names (blue), but when i login remotely using ssh i can see the directories (blue).
0
 
karlwilburCommented:
So, you are seeing the directory nemes but they are not blue?

if so, log in from the console and try this:

alias ls='ls --color=auto'

then do your ls -l

if this works, then the following will be a more permanent solution.

Edit you .bash_profile (if not there, create it):

vi ~/.bash_profile

insert:

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
      . ~/.bashrc
fi

then edit .bashrc (if not there, create it):

and add the previous alias command here, verbatim.  

You can really add it anywhere in the file but you should read up on .bash_profile and .bashrc for prefered placement.

Here is a sample .bashrc file from The Linux Documentation Project's site (may be a little complicated for you, or maybe not):
http://www.tldp.org/LDP/abs/html/sample-bashrc.html

here is a sample .bash_profile:
http://www.karlwilbur.net/linux/howto/bash/sample-bash_profile.html

Hope this does the trick, keep us updated.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
ahoffmannCommented:
> i mean that when i login ..
where do you log in? with X?
0
 
karlwilburCommented:
Sure, you could login with X then open a terminal window or if you've set up your systen so that X doesn't start automatically and you get to a text login, you can login there too, without having to start X.  Or if X startd and you don't want to login to X you can hit Ctrl+Alt+(F1-F6) to get any of the 6 VCs (Virtual Consoles) that are running on you system and login there.

(Once you have escaped X using Ctrl+Alt+F(1-6), you can switch between VCs by Alt+F(1-6) since there is no need to use the Ctrl key any more...or maybe it's the other way around and you use Crtl to switch and don't need Alt anymore...you can fugure it out.)

If you use Ctrl+Alt+(F1-F6) to get to a VC and want to get back to X, it's running on VC7 (Alt+F7).

Anyway, just get to a command line.

In vi (the text editor that I mention above...because I really like it since I am very familiar with it) you hit "i" to change into "insert mode" and when you are finished editing, hit "Esc" to exit "insert mode".  Hit ":" to get a vi command line and type "w" to write(save) and "q" to quit.  cOmmAnds ArE cAsE sEnsItIvE.
0
 
karlwilburCommented:
Sorry ahoffmann, I didn't read who posted the comment.  I though your question was from lomaree.

-Karl
0
 
lomareeAuthor Commented:
my /root/.bash_profile is like this


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="root"

export USERNAME BASH_ENV PATH
alias ls='ls'
0
 
karlwilburCommented:
change

alias ls='ls'

to

alias ls='ls --color=auto'
0
 
lomareeAuthor Commented:
and my /root/.bashrc looks like this where as the link you gave me for it looks a very different

# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
0
 
karlwilburCommented:
IN that link, there was a _lot_ more stuff.  Yours is fine.  The alias commands should really be in just on fiole.  I think that .bashrc is the preferred.  So, you can delete the alias command from .bash_[rpfile and enter this in the .bashrc just below the others.

alias ls='ls --color=auto'

0
 
karlwilburCommented:
Sorry about all of that.   I am typing in the dark.  I'll try again.

To keep the alias commands in the .bashrc file, delete the alias command for ls from .bash_profile and add the other alias command for ls to the .bashrc file.

-Karl
0
 
lomareeAuthor Commented:
i tried doing that, but as soon as i do and re login in the machine and use "ls -l" , i can't see nothing.
0
 
karlwilburCommented:
You see nothing?  no files, no directories?

try

ls -la

for future, you don't have to logout to reload a changed .bash_profile, just type

source ~/.bash_profile

-Karl
0
 
lomareeAuthor Commented:
what do you mean other alias command for ls ???
0
 
lomareeAuthor Commented:
yeah i can't see any directories that is cuz by default there are in color blue and i can't see blue (hope you understood my problem) i can see files and all
0
 
karlwilburCommented:
alias ls='ls --color=auto'
0
 
ahoffmannCommented:
> alias ls='ls'
grrr, please get rid of any alias which aliases basic system commands (ls, rm, mv, cd, etc. etc.)
Belief me, this is BS !
and may cause a lot of problems, unless you know 300% what are you doing and how it works.

Also, please tell us which user (root, any other) has the ls problems on which login (console, X, rlogin, ssh).

I also recommend that you get rid of all ~/.bash* and ~/.profile for user root, until your account works with the system settings (from /etc). Then you can slihgly begin to design your own settings. Take care that bash keeps all its dragons there (~/.bash*) secret, until you find them yourself ;-)
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 9
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now