Posts tagged ‘grep’

  • Ubuntu doesn’t asking for login after boot up ( may happen after unexpected shutdown ) :
    press Ctrl-Alt-F1 to login in terminal mode and use fsck to fix it
  • Add user short memo :
    [root@my-box ~]# useradd -g users -u 560 tuser
    [root@my-box ~]# passwd tuser

    ps. sudo will be required in not-root case 🙂
  • Proper access rights for .ssh files :
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/id_rsa
    chmod 644 ~/.ssh/id_rsa.pub
    chmod 644 ~/.ssh/authorized_keys
    chmod 644 ~/.ssh/known_hosts
  • List all files in folder sorted by size :
    find . -type f -exec du -k "{}" \; | sort -n

Actually newbies in Solaris ( and experienced users in Linux :-)) have troubles with some every-day routines which works in Solaris in a different way than in most Linux like Ubuntu. Below I try to list most ”popular” problems and questins about differences in Solaris and Linux and try to figure them out.

  • grep doesn’t have -r switch, so there’s no recursive looking throught directories, here’s alternatives for recursive grep on Solaris :
    grep 'somestring' `find . -name '*'`
    find . | xargs grep 'somestring'
  • tar doesn’t support -z option, so tar xfz my_archive.tar.gz will fail with error “tar: z: unknown function modifier“. To unpack tar.gz archive on Solaris you may use this one :
    gzip -dc my_archive.tar.gz | tar xvpf -
  • how to set environment variables in Solaris ( i set them in \~/.bashrc, but it doesn’t works )  : to make Solaris read and apply to user environment barsh_rc file try to create file ~/.bash_profile in your home, and put in it lines listed below :
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi

To be continued…

Usefull links : Solaris Infrequently Asked and Obscure Questions