User login

Poll

Doriti un alt design pentru forum ?
Da
56%
Nu
44%
Total votes: 9

[banner]

[banner]

[banner]

In consola sa arate in ce director ma aflu

Cum fac sa imi arate in ce director ma aflu?
Deci cand eu ii dau cd /etc sa-mi arate cum imi arata in Linux:

root@X:~# cd /etc/
root@X:/etc#

In FreeBSD nu imi arata. Am auzit ca trebuie edita in /root/.profiles dar nu stiu exact ce linie sa adaug si ce sa fac dupa aceea.

Ma ajuta cineva ?

In consola sa arate in ce director ma aflu

Depinde ce shell foloseti. Pentru tcsh, baga asta in ~/.cshrc

# .tcshrc - 30/06/05 19:16 - Turea Alexandru Teodor (classicmanpro@yahoo.com)

if ( ${uid} == 0 ) set root

#######################
# ##### GENERAL ##### #
#######################

umask 022

limit    coredumpsize 0
limit -h coredumpsize 0

#####################################
# ##### ENVIRONMENT VARIABLES ##### #
#####################################

setenv    LS_COLORS    'no=01;37:fi=01;37:di=01;34:ln=01;36:pi=01;32:so=01;35:do=01;35:bd=01;33:cd=01;33:ex=01;31:mi=00;05;37:or=00;05;37:'

setenv    PAGER        'less'
setenv    EDITOR       'vim'
setenv    VISUAL       "${EDITOR}"

unsetenv  HPATH

###############################
# ##### SHELL VARIABLES ##### #
###############################

set color
set filec
set rmstar
set dunique
set autolist
set ellipsis
set dextract
set addsuffix
set noclobber
set autoexpand
set autocorrect
set pushdsilent
set pushdtohome
set printexitvalue

set history     = 500
set savehist    = 500

set savedirs    = 50

set killring    = 50
set killdup     = all

set correct     = cmd
set listjobs    = long
set echo_style  = both
set symlinks    = chase
set inputmode   = insert
set matchbeep   = ambiguous
set promptchars = '%#'
set listflags   = 'A'

set watch       = (0 any any)
set who         = "%n(`whoami`) has %a %l from %M"

unset {histfile,dirsfile,autologout,implicitcd,notify,tperiod}

#######################
# ##### ALIASES ##### #
#######################

alias    .                'source'

alias    rmd              'rm -fr'

alias    x                'exit'
alias    z                'suspend'
alias    j                'jobs -l'

alias    p                "${PAGER}"
alias    e                "${EDITOR}"

alias    ds               'dirs -v'

alias    po               'popd'  # po    [+n]
alias    pu               'pushd' # pu    [name|+n]

alias    cd               'pu'    # cd    [name|+n]
alias    chdir            'cd'    # chdir [name|+n]

alias    ..               'cd ..'
alias    -                'cd -'

alias    c                'clear'
alias    h                'history'
alias    hc               'history -c'
alias    hcc              'hc;c'

alias    cx               'cd;dsc;hc;x'

alias    ll               'ls -FGla'
alias    ls               'ls -FG'
alias    la               'ls -FGa'

alias    mcd           'mount /cdrom'
alias    umcd          'umount /cdrom'

alias    ff               "find . -name '!*' -print"

alias    psa              'ps aux'
alias    psu              'ps  ux'

alias    lpsa             "ps aux !* | p"
alias    lpsu             "ps  ux !* | p"


alias    dmsg             'dmesg | p'

alias    s                'sudo'
if ( ${?root} ) then
   alias    efstab       'e /etc/fstab'
endif

###############################
# ##### SPECIAL ALIASES ##### #
###############################

alias helpcommand 'man' # run-help

unalias {beepcmd,cwdcmd,jobcmd,periodic,precmd,postcmd,shell}

###########################
# ##### COMPLETIONS ##### #
###########################

complete mount 
   'n/-t/(4.2 4.3 adfs affs autofs bdev coda coherent cramfs devpts efs ext ext2 ext3 hfs hpfs iso9660 jfs mfs minix msdos ncpfs nfs ntfs pipefs proc qnx4 ramfs reiserfs romfs rootfs S51K S52K shm smbfs sockfs sysv tmp tmpfs udf ufs umsdos usbfs usbdevfs vfat xenix xfs xiafs)/' 
   'n/-o/(async atime auto defaults dev exec _netdev noatime noauto nodev noexec nosuid nouser remount ro rw suid sync dirsync user users)/' 
   'n/-O/(async atime auto defaults dev exec _netdev noatime noauto nodev noexec nosuid nouser remount ro rw suid sync dirsync user users)/' 
   'p/*/f/' 
   'p/*/d/'
complete find 
   'n/-anewer/f/'                   
   'n/-cnewer/f/'                   
   'n/-group/g/'                    
   'n/-ilname/f/'                   
   'n/-iname/f/'                    
   'n/-ipath/f/'                    
   'n/-iregex/f/'                   
   'n/-lname/f/'                    
   'n/-name/f/'                     
   'n/-newer/f/'                    
   'n/-path/f/'                     
   'n/-regex/f/'                    
   'n/-type/(b c d p f l s D)/'     
   'n/-user/u/'                     
   'n/-xtype/(b c d p f l s D)/'    
   'n/-exec/c/'                     
   'n/-fls/f/'                      
   'n/-fprint/f/'                   
   'n/-fprint0/f/'                  
   'n/-fprintf/f/'                  
   'n/-ok/c/'                       
   'c/--/(help version)/'           
   'c/-/(daystart depth follow help maxdepth mindepth mount noleaf version xdev amin anewer atime cmin cnewer ctime empty false fstype gid group ilname iname inum ipath iregex links lname mmin mtime name newer nouser nogroup path perm regex size true type uid used user xtype exec fls fprint fprint0 fprintf ok print print0 printf prune ls)/' 
   'n/-fstype/(4.2 4.3 adfs affs autofs bdev coda coherent cramfs devpts efs ext ext2 ext3 hfs hpfs iso9660 jfs mfs minix msdos ncpfs nfs ntfs pipefs proc qnx4 ramfs reiserfs romfs rootfs S51K S52K shm smbfs sockfs sysv tmp tmpfs udf ufs umsdos usbfs usbdevfs vfat xenix xfs xiafs)/' 
   'p/*/d/'
complete {mkfs,fsck} 'n/-t/(4.2 4.3 adfs affs autofs bdev coda coherent cramfs devpts efs ext ext2 ext3 hfs hpfs iso9660 jfs mfs minix msdos ncpfs nfs ntfs pipefs proc qnx4 ramfs reiserfs romfs rootfs S51K S52K shm smbfs sockfs sysv tmp tmpfs udf ufs umsdos usbfs usbdevfs vfat xenix xfs xiafs)/'
complete {man,where,which,whatis,sudo,info,apropos} 'p/*/c/'
complete kill 'c/-/S/' 'n/-s/S/' 'c/%/j/' 'p/*/(%)/'
complete qmake 'n/-o/(Makefile)/' 'p/*/f:*.pro/'
complete {cat,pico,nano,vi,vim,view,emacs} 'p/*/f/'
complete {{,un}setenv,printenv,env} 'p/*/e/'
complete {fg,bg,stop} 'c/%/j/' 'p/*/(%)/'
complete {,un}alias 'p/*/c/' 'p/*/a/'
complete {cd,pushd,{ch,mk,rm}dir} 'p/*/d/'
complete {finger,pinky,groups} 'p/*/u/'
complete {,un}complete 'p/1/X/'
complete {,un}set 'p/*/s/'

##############################
# ##### PROMPT SECTION ##### #
##############################

# set color_name = '%{^[[ color_code m%}'

set rgb_restore   = '%{^[[00m%}'
set rgb_black     = '%{^[[00;30m%}'
set rgb_firebrick = '%{^[[00;31m%}'
set rgb_red       = '%{^[[01;31m%}'
set rgb_forest    = '%{^[[00;32m%}'
set rgb_green     = '%{^[[01;32m%}'
set rgb_brown     = '%{^[[00;33m%}'
set rgb_yellow    = '%{^[[01;33m%}'
set rgb_navy      = '%{^[[00;34m%}'
set rgb_blue      = '%{^[[01;34m%}'
set rgb_purple    = '%{^[[00;35m%}'
set rgb_magenta   = '%{^[[01;35m%}'
set rgb_cadet     = '%{^[[00;36m%}'
set rgb_cyan      = '%{^[[01;36m%}'
set rgb_gray      = '%{^[[00;37m%}'
set rgb_white     = '%{^[[01;37m%}'

set rgb_std       = "${rgb_white}"

if ( ${?root} ) then
   set rgb_usr = "${rgb_red}"
else
   set rgb_usr = "${rgb_green}"
endif

if ( ${?prompt} ) set prompt="${rgb_usr}`whoami`${rgb_std} %c ${rgb_usr}%#${rgb_restore} "

unset rgb_*

############################
# ##### KEY BINDINGS ##### #
############################

bindkey "^[j" complete-word-back
bindkey "^[k" complete-word-fwd

bindkey "^[m" list-glob

bindkey "^[e" expand-line
bindkey "^[g" expand-glob
bindkey "^[v" expand-variables

bindkey "^[z" normalize-path
bindkey "^[x" normalize-command

bindkey "^[i" i-search-fwd
bindkey "^[I" i-search-back

bindkey "^[a" spell-line
bindkey "^[o" overwrite-mode
bindkey "^[q" keyboard-quit

#############################################
# ##### SOURCE/LOAD - DIRECTORY STACK ##### #
#############################################

#set usr_cwd = "`pwd`" # most WMs open terminals in specific locations therefore note the current working directory
#dsl                   # source/load the directory stack, if present ... this usually changes the current working directory
#cd "${usr_cwd}"       # 'cd' back to the initial/original working directory and push it onto the directory stack
#unset usr_cwd         # cleanup

#######################
# ##### THE END ##### #
#######################

if ( ${?root} ) unset root

Configul asta face mult mai multe decat sa-ti faca promptul smecheros. Te sfatuiesc sa-l citesti pe tot si sa intelegi cam ce face. Nu e facut de mine, eu doar l-am modificat putin, ai adresa autorului la inceputul fiiserului.

In consola sa arate in ce director ma aflu

Depinde ce shell folosesti. Pt bash editezi 2 fisiere in directorul personal.

# ~/.bashrc file example

PS1="(u) w > "
 
export PS1

w = working directory
u = user
h = hostname etc

# ~/.bash_profile file

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

. ~/.bashrc e echivalent cu sh ~/.bashrc

In consola sa arate in ce director ma aflu

pentru csh/tcsh (default FreeBSD shell) solutia e mult mai simpla decat pare, in ~/.cshrc adaugi o linie:

set prompt='%B[%n@%m]%b:[B]%~[/B]%# '

acum, explicatiile:
%B se expandeaza la de aici inainte scrie cu bold
%n se expandeaza la username
%m se expandeaza la hostname (forma scurta, nu FQDN)
%b se expandeaza la de aici inainte scrie cu font normal
%~ se expandeaza la current working dir
%# se expandeaza la ">" daca uid<>0 si la "#" daca uid=0