giver user
$fs sa ~/private/xianeizhang l
$fs sa simu01 xianeizhang rlidwka
$fs listacl ~/private/simu01
remove a user
$fs setacl -dir ~/private/simu01 -acl xianeizhang none
$kinit
$klist
$kdestroy
$kinit -R
$aklog
$tokens
unlog
steps:
$ktutil
#-- after -k is digit '1', NOT letter 'l'
ktutil: addent -password -p xianeizhang@DEPT.CS.PITT.EDU -k 1 -e aes256-cts
Password for xianeizhang@DEPT.CS.PITT.EDU:
#-- write out the keytab to disk
ktutil: wkt xianeizhang.keytab
ktutil: q
#-- no output if smoothly executed
$kinit xianeizhang@DEPT.CS.PITT.EDU -k -t xianeizhang.keytab
$klist -k xianeizhang.keytab
KVNO Principal
---- -------------------------------------------
1 xianeizhang@DEPT.CS.PITT.EDU
$ktutil:
ktutil: read_kt xianeizhang.keytab
ktutil: list
slot KVNO Principal
---- ---------------------
1 1 xianeizhang@DEPT.CS.PITT.EDU
#-- delete the key from keytab file <delent #slot>
ktutil: delent 1
ktutil: list
ktutil: q
steps
$kinit xianeizhang
$aklog
$nohup $HOME/bin/krb_afs_renewal.sh &
script
click here to download krb_afs_renewal.sh
When you delete or change a file by mistake, you should first checked the backup
To view a Project Volume backup, you must mount it. Follow these steps:
#-- login afs server
#-- enter project volume directory
$cd ~/private/bench/
#-- get the volume
$fs lq .
Volume Name Quota Used %Used Partition
cs.u.x.zhang.bench 200000000 141054086 71% 55%
#-- mount the volume's backup, <proj-volume>.backup
#-- e.g., volume is cs.u.x.zhang.bench, and backup should be cs.u.x.zhang.bench.backup
$cd ~/private/simu10
$fs mkm bench.1130 cs.u.x.zhang.bench.backup
#-- now, restore the changed file
$cp bench.1130/<filename> ~/private/bench
#-- you don't need to unmount the volume, as files in .backup do not count against your disk quota usage
#-- but unmounting is possible
$fs rmmount bench.1130
If you failed to discover the mistake the same day, the only way to restore files is to contact technical staff to let them load backup tapes to restore the files.
More backup restore info can be found at CMU afs and Stanford afs
Crontab can be used to schedule a job that runs on certain interval cron_cmd.
MIN HOUR DOM MON DOW CMD
*/5 * * * * /home/my.sh
0 */5 * * * /home/my.sh
Setup a task:
$crontab -e
0 * * * * $HOME/bin/krb_afs_renewal.sh
*/1 * * * * $HOME/bin/krb_afs_renewal.sh
Cron job cannot be used to schedule a job in seconds interval.
while true
do
/home/my.sh
sleep 5
done
$nohup ./every-5-seconds.sh &
$jobs (kill %n)
$fg <job id>
$^Z
refer to a job:
#-- %1' is 'fg %1', bringing job 1 from background to foreground
$%n
#-- resumes job 1 in the background, equivalent to 'bg %1'
$%1 &
$ls -F
chmod a+rw file.dat
chmod o-rx file.dat
chmod go-rwx file.dat
$ln file1 file2
$ln -s file1 file2
visit blog1 and blog2 to learn more ...
$cat /etc/shells
echo $0
or echo $SHELL
####(2) Shell autologout$echo $autologout
$unset autologout
shell environment variables
$[print]env (list all)
$setenv SVN_EDITOR vim (bash: export SVN_EDITOR=vim)
$setenv PATH "${PATH}:/usr/local:/usr/local/bin"
get the last n characters of a string: ${str:${#str}-$n}
${string:offset[:length]}
loop
for bankID in {0..7}
for (( bankID=0; bankID <= 7; bankID++ ))
if (( $n <= 5)) i.e., if [ $n -le 5 ]
settings
cfg:
CHIP="4Gb"
ROWS_2Gb=32768
ROWS_4Gb=65536
ROWS_8Gb=131072
.sh:
row_name="ROWS_$CHIP"
ROWS=${!row_name}
value extraction:
for chunk_dir in $(find $scheme_dir -maxdepth 1 -mindepth 1 -type d -name "1024_chunks" -o -name "16384_chunks")
info
NOW=$(date)
SERVERNAME=${hostname}
CWD=$(pwd)
get user input via keyboard
$read -p "Enter something:" var1 var2 var3
$nproc
$lscpu
$less /proc/cpuinfo
/sys/devices/system/cpu/cpu0/cache/index[0-3]/…
or getconf LEVEL1_DCACHE_LINESIZE
commands:
$top
$shift+A to have multi-window process view
$type k and input PID to kill a process
$type u and input user name to get process from the user alone
detailed info
$ps -Af
$free -m
$df -h
$uname -a/-m
or $arch
$ldd --version
$strings /usr/local/gcc-4.8.2/lib64/libstdc++.so.6 | grep LIBCXX
$gcc --version
$ldd <executable>
/pin-2.13-62732-gcc.4.4.7-linux/intel64/runtime/cpplibs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found ( required by/obj-intel64/pinatrace.so),
$strings libstdc++.so.6 | grep GLIBCXX
$cp /usr/local/gcc-4.8.2/lib64/libstdc++.so.6 .
$getconf PAGESIZE
cout word frequency in a file
$ tr ' ' '\n' < test.trace/test_anno | grep memR | wc -l
$grep -o -c mem test.trace/test_anno
var=xxx
var-xxx
var:=xxx
echo "default'=': dist= ${dist=1.0}" #-- dist=1.0
echo "after'=': dist= $dist" #-- dist=1.0
echo "---------"
echo "default '-': weather= ${weather-sunny}" #-- weather=sunny
echo "after '-': weather= $weather" #-- weather= ('-' just use default, never set)
echo "---------"
weather="" #-- weather has been set, but just an empty value
echo "default '-': weather= ${weather-sunny}" #-- weather=
echo "default '=': weather= ${weather=sunny}" #-- weather=
echo "default ':=': weather= ${weather:=sunny}" #-- weather= sunny
echo "---------"
unset weather #--weather now is unset
echo "default '=': weather= ${weather=sunny}" #-- weather= sunny
echo "default ':=': weather= ${weather:=sunny}" #-- weather= sunny
integer operation
#op=+-*/% ++ -- ** and comparison
$(( var1 op var2 ))
float operation
$(echo "scale=2; $total_time/$reads" | bc -l)
$(awk -v tot=$total_time -v read=$reads 'BEGIN{printf("%.2f", tot/read)}'
difference between [ and [[
[[ handles empty strings and strings with whitespaces, so no need to quote variaes
if [ -f "$file" ] i.e., if [[ -f $file ]]
[ ! $file ]
[[ $sentence == $checkme ]] i.e., [ "$sentence" == "$checkme" ]
[ is the same as 'test' builtin, and works like the 'test' binary
if test "$name" = "xianwei" i.e., if [ "$name" = "xianwei" ]
for [, operators like && and || must be used in separate brackets
if [ $foo -ge 3 -a $foo -lt 10 ]
if [ $first -eq 0 ] && [ $second -eq 0 ], i.e., if [[ $first -eq 0 && $second -eq 0 ]]
if [ $first -eq $second]
[[ is bash specific, == and != apply bash pattern matching rules
if [[ $suffix == *ECC* ]]
[[ has a =~ regex match operator
if [ "$ANSWER" = y -o "$ANSWER" = yes ]
or
if [[ $ANSWER =~ ^y(es)?$ ]]
or
if [[ $ANSWER = y* ]]
others
empty (unset, tab/space) string: if [ -z $test_str ]
if [[ $test_str != foo]],
i.e., if [ ! "test_str" == "foo" ],
i.e., if [ "test_str" != foo ]
$tar cvf archive_name dirname/ (note: no compression here)
c -- create a new archive
v -- verbosely list files which are processed
f - following is the archive file name
$tar cvfz archieve_name.tar.gz dirname/ (note: creating a tar gizpped archive)
z -- filter the archive through gzip
note: .tgz is same as .tar.gz
$tar cvfj archive_name.tar.bz2 dirname/ (note: a bzip2 tar archive)
j -- filter the archive through bzip2
gzip vs bzip2: bzip2 takes more time to compress and decompress than gzip, but bzip2 is smaller in size
note: .tbz and .tb2 is same as .tar.bz2
$tar xvf archive_name.tar
x -- extract files from archive
$tar xvf archive_name.tar -C /target/dir
note: extract to a specified dir
$tar xvfz archive_name.tar.gz
note: extract a gizpped tar archive
$tar xvfj archive_name.tar.bz2
note: extract a bzipped tar archive
$tar tvf archive_name.tar
$tar tvfz archive_name.tar.gz
$tar tvfj archive_name.tar.bz2
$tar xvf archive_file.tar /path/to/file
$tar xvfz archive_file.tar.gz /path/to/file
$tar xvfj archive_file.tar.bz2 /path/to/file
extract a/multiple dirs from a tar archive
$tar xvf archive_file.tar /path/to/dir1/ /path/to/dir2/
extract group of files using regex
$tar xvf archive_file.tar --wildcards '*.cpp'
$tar rvf archive_name.tar newfile
note: cannot add file or dir to a compressed archive
$tar -cf - /dir/to/archive | wc -c
$tar -czf - /dir/to/archive | wc -c
$tar -cjf - /dir/to/archive | wc -c
wget --no-check-certificate
default \underline{} doesn’t allow line breaks; use \ul{} command of soul package instead:
underline
\usepackage{soul}
\ul{xxx}
author-year
\bibliographystyle{apalike}
(linebreak issue)
solution to linebreak:
\usepackage[square]{natbib}
\let\citeN\citet
\let\cite\citep
------------ number
\usepackage[square, numbers]{natbib}
Without spacing line:
\usepackage[square, authoryear]{natbib}
\let\OLDthebibliography\thebibliography
\renewcommand\thebibliography[1]{
\OLDthebibliography{#1}
\setlength{\parskip}{0pt} #space bt paras
\setlength{\itemsep}{0pt plus 0.3ex} #space bt items
\begin{singlespace}
\bibliographystyle{plainnat}
\bibliography{refresh,twr,scaling,jedec,dram,approx_security,stacked,page_os,hpca16}
\end{singlespace}
OR ----> bbl
\addtolength\itemsep{-1em}
}
\bibliographystyle{plainnat}
\usepackage{pifont}
\ding{202}
\ding{203}
\usepackage{chngcntr}
\counterwithin{figure}{chapter}
\counterwithin{table}{chapter}
\usepackage{titling}
\setlength{\droptitle}{-9em} % This is your set screw
\begin{document}
\title{Research Statement\vspace{-2ex}}
\author{Xianwei Zhang%\\
% \texttt{xianeizhang@cs.pitt.edu}
}
\date{}
\maketitle
\usepackage{titlesec}
%\titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}