top of page
Writer's pictureShashi Kallae

Custom .bash_profile

Updated: Nov 9, 2023

#### 1. Prompt #######


# User Prompt

export P=`hostname`"@"`echo $LOGNAME`

d=$(date +'%I:%M:%S %p')

PS1='

$PWD [\d - \D{%I:%M:%S %p}]

$P $ '


#### 2. Alias ######


# xauth

alias getx="xauth list; echo $DISPLAY"

alias weadmin="sudo su - weadmin"

alias lt="ls -lathr"

alias rm="rm -i"

alias get2dayfile="ls -al --time-style=+%F | grep $(date +%F)"

alias cls="clear"

alias getds='for i in $(du -sk *|sort -nr|cut -f2); do du -sh $i; done 2>/dev/null' # Displays Directory Sizes in DESC

alias rm='rm -i' # This avoids accidental deletion of any files/directories

alias getsysinfo='uname -an'

alias getbitsize='getconf LONG_BIT'

alias getpackageinfo="rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n'|egrep 'compat|glibc|libstc|gcc|binutils|libaio|libstdc++|libgcc|libXext|libXtst|libXi|openmotif|redhat|sysstat|unix*'|sort"

alias get2dayfile='ls -al --time-style=+%D | grep $(date +%D)'

alias get2fileonly='find $(pwd) -maxdepth 1 -type f -mtime -1'

alias get2dironly='find $(pwd) -maxdepth 1 -type d -mtime -1'

alias getruntimewebadminproc="top -n 1 -b -u webadmin|sed 's/^[ \t]*//;s/[ \t]*$//'"

alias getcpuinfo='lscpu'






# Functions


## Find a File


function findfile()


{


find $(pwd) -name "$@";


}




## File Backup


function backup()


{


cp "$@" "$@"_$(date +'%b%d%Y_%I%M%p');


}




## file Backup with name backup


function safebkup()


{


cp "$@" bakup_"$@"_$(date +'%b%d%Y_%I%M%p');


}




## Rename the file


function fileren()


{


mv "$@" "$@"_$(date +'%b%d%Y_%I%M%p');


}



15 views0 comments

コメント

5つ星のうち0と評価されています。
まだ評価がありません

評価を追加
bottom of page