$ 4.2.36 1 501---> echo $* $ 4.2.36 2 502---> echo "$*" $ 4.2.36 3 503---> echo $IFS $ 4.2.36 4 504---> set $IFS=rightleftwrong $ 4.2.36 5 505---> echo $* =rightleftwrong $ 4.2.36 6 506---> echo "$*" =rightleftwrong $ 4.2.36 7 507---> echo $IFS $ 4.2.36 8 508---> echo $* =rightleftwrong $ 4.2.36 9 509---> read $* jeff bash: read: `=rightleftwrong': not a valid identifier $ 4.2.36 10 510---> read $* bash: read: `=rightleftwrong': not a valid identifier $ 4.2.36 11 511---> read $*; bash: read: `=rightleftwrong': not a valid identifier $ 4.2.36 12 512---> var1=1+2+3 $ 4.2.36 13 513---> echo $var1 1+2+3 $ 4.2.36 14 514---> IFS=+ $ 4.2.36 15 515---> echo $var1 1 2 3 $ 4.2.36 16 516---> IFS=- $ 4.2.36 17 517---> echo $var1 1+2+3 $ 4.2.36 18 518---> IFS=" " $ 4.2.36 19 519---> echo $var1 1+2+3 $ 4.2.36 20 520---> IFS="," $ 4.2.36 21 521---> echo $var1 1+2+3 $ 4.2.36 22 522---> var1=1+2,+3 $ 4.2.36 23 523---> echo $var1 1+2 +3 $ 4.2.36 24 524--->
bash -r restricted shell
$ 4.2.36 8 508---> bash -r $ 4.2.36 1 501---> ls Algorithms bookmark bugs-general debian-howtos firewall kernel linux README beautifulwork books config-files Docs https: language ovlfose $ 4.2.36 2 502---> cd .. bash: cd: restricted $ 4.2.36 3 503---> cd / bash: cd: restricted $ 4.2.36 4 504---> ./firewall/firewall.bw bash: ./firewall/firewall.bw: restricted: cannot specify `/' in command names $ 4.2.36 5 505---> cat config-files/dot-muttrc > check bash: check: restricted: cannot redirect output $ 4.2.36 6 506---> enable enable . enable : enable [ enable alias enable bg enable bind enable break enable builtin enable caller enable cd enable command enable compgen enable complete enable compopt enable continue enable declare enable dirs enable disown enable echo enable enable enable eval enable exec enable exit enable export enable false enable fc enable fg enable getopts enable hash enable help enable history enable jobs enable kill enable let enable local enable logout enable mapfile enable popd enable printf enable pushd enable pwd enable read enable readarray enable readonly enable return enable set enable shift enable shopt enable source enable suspend enable test enable times enable trap enable true enable type enable typeset enable ulimit enable umask enable unalias enable unset enable wait $ 4.2.36 7 507---> enable enable . enable : enable [ enable alias enable bg enable bind enable break enable builtin enable caller enable cd enable command enable compgen enable complete enable compopt enable continue enable declare enable dirs enable disown enable echo enable enable enable eval enable exec enable exit enable export enable false enable fc enable fg enable getopts enable hash enable help enable history enable jobs enable kill enable let enable local enable logout enable mapfile enable popd enable printf enable pushd enable pwd enable read enable readarray enable readonly enable return enable set enable shift enable shopt enable source enable suspend enable test enable times enable trap enable true enable type enable typeset enable ulimit enable umask enable unalias enable unset enable wait $ 4.2.36 8 508---> $ 4.2.36 8 508---> enable --help bash: enable: --: invalid option enable: usage: enable [-a] [-dnps] [-f filename] [name ...] $ 4.2.36 9 509---> enable -d bash: enable: restricted $ 4.2.36 10 510--->
reportbug tool
commandline session
$ 4.2.36 8 508---> reportbug --debug
Please enter the name of the package in which you have found a problem, or type 'other' to report a more
general problem.
> testing
*** Welcome to reportbug. Use ? for help at prompts. ***
Note: bug reports are publicly archived (including the email address of the submitter).
Detected character set: UTF-8
Please change your locale if this is incorrect.
Using 'Jeffrin Jose Thalakkottoor ' as your from address.
Getting status for testing...
No matching source or binary packages.
A package named "testing" does not appear to be installed; do you want to search for a similar-looking filename
in an installed package [Y|n|q|?]? n
Getting available info for testing...
Please enter the version of the package this report applies to (blank OK)
> 1.1
Will send report to Debian (per lsb_release).
Querying Debian BTS for reports on testing (source)...
No bug reports found.
Briefly describe the problem (max. 100 characters allowed). This will be the bug email subject, so keep the
summary as concise as possible, for example: "fails to send email" or "does not start with -q option specified"
(enter Ctrl+c to exit reportbug without reporting a bug).
> testing
How would you rate the severity of this problem or report?
1 critical makes unrelated software on the system (or the whole system) break, or causes serious data
loss, or introduces a security hole on systems where you install the package.
2 grave makes the package in question unusable by most or all users, or causes data loss, or
introduces a security hole allowing access to the accounts of users who use the package.
3 serious is a severe violation of Debian policy (that is, the problem is a violation of a 'must' or
'required' directive); may or may not affect the usability of the package. Note that non-
severe policy violations may be 'normal,' 'minor,' or 'wishlist' bugs. (Package maintainers
may also designate other bugs as 'serious' and thus release-critical; however, end users
should not do so.). For the canonical list of issues worthing a serious severity you can
refer to this webpage: http://release.debian.org/wheezy/rc_policy.txt .
4 important a bug which has a major effect on the usability of a package, without rendering it completely
unusable to everyone.
5 does-not-build a bug that stops the package from being built from source. (This is a 'virtual severity'.)
6 normal a bug that does not undermine the usability of the whole package; for example, a problem with
a particular option or menu item.
7 minor things like spelling mistakes and other minor cosmetic errors that do not affect the core
functionality of the package.
8 wishlist suggestions and requests for new features.
Please select a severity level: [normal] 7
Do any of the following apply to this report?
1 d-i This bug is relevant to the development of debian-installer.
2 ipv6 This bug affects support for Internet Protocol version 6.
3 l10n This bug reports a localization/internationalization issue.
4 lfs This bug affects support for large files (over 2 gigabytes).
5 patch You are including a patch to fix this problem.
6 upstream This bug applies to the upstream part of the package.
7 none
Please select tags: (one at a time) [none]
Spawning sensible-editor...
No changes were made in the editor.
Report will be sent to Jeffrin Jose Thalakkottoor
Submit this report on testing (e to edit) [y|n|a|c|E|i|l|m|p|q|d|t|s|?]? y
Report is unchanged. Edit this report or quit [E|q|s|?]? s
Sending empty report anyway...
Connecting to smtp.mail.yahoo.com:4100 via SMTP...
SMTP send failure: Connection unexpectedly closed: [Errno 104] Connection reset by peer. Do you want to retry
(or else save the report and exit)? [Y|n|q|?]?
HACKS AT LINUX KERNEL
Linux(kernel) System Administration
|
1. Memory Management – Virtual Memory Using /proc/sys/vm |
TOOLS PLAN
Project Diagram
GNU bash –noediting and -v
commandline session
$ 4.2.36 5 505---> bash --noediting
$ 4.2.36 1 501---> tcp
bash: tcp: command not found
$ 4.2.36 2 502--->
$ 4.2.36 2 502---> exit
exit
$ 4.2.36 6 506---> tcprobe
$ 4.2.36 16 516---> bash -v
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}u@h:w$ '
# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
# PROMPT_COMMAND='echo -ne " 33]0;${USER}@${HOSTNAME}: ${PWD} 07"'
# ;;
#*)
# ;;
#esac
# enable bash completion in interactive shells
#if ! shopt -oq posix; then
# if [ -f /usr/share/bash-completion/bash_completion ]; then
# . /usr/share/bash-completion/bash_completion
# elif [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
# fi
#fi
# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
function command_not_found_handle {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/bin/python /usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not foundn" "$1" >&2
return 127
fi
}
fi
#export PS1="[ 33[0;31m] $ V # ! "
export PS1="$ V # !---> "
shellp()
{
pre=: post=:
printf "$pre%s$postn" "$@"
}
procmailx ()
{
ORGMAIL=/var/mail/$LOGNAME
if cd $HOME &&
test -s $ORGMAIL &&
lockfile -r0 -l1024 .newmail.lock 2>/dev/null
then
trap "rm -f .newmail.lock" 1 2 3 13 15
umask 077
lockfile -l1024 -ml
cat $ORGMAIL >>.newmail &&
cat /dev/null >$ORGMAIL
lockfile -mu
formail -s procmail
/proc/meminfo related
# cat /proc/meminfo MemTotal: 1995608 kB MemFree: 77804 kB Buffers: 226640 kB Cached: 306916 kB SwapCached: 1256 kB Active: 817952 kB Inactive: 458696 kB Active(anon): 553568 kB Inactive(anon): 193212 kB Active(file): 264384 kB Inactive(file): 2100484 kB Unevictable: 4696 kB Mlocked: 4696 kB SwapTotal: 5843964 kB SwapFree: 5838604 kB Dirty: 752 kB Writeback: 0 kB AnonPages: 746892 kB Mapped: 132928 kB Shmem: 1036 kB Slab: 534784 kB SReclaimable: 512904 kB SUnreclaim: 21880 kB KernelStack: 2688 kB PageTables: 23316 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 6841768 kB Committed_AS: 2595056 kB VmallocTotal: 34359738367 kB VmallocUsed: 114500 kB VmallocChunk: 34359621192 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 364480 kB DirectMap2M: 1667072 kB #
SHLVL – Incremented by one each time an instance of bash is started
commandline session
$ 4.2.36 2 501---> echo $SHLVL 1 $ 4.2.36 3 502---> echo $SHLVL 1 $ 4.2.36 4 503---> bash $ 4.2.36 1 500---> echo $SHLVL 2 $ 4.2.36 2 501---> logout bash: logout: not login shell: use `exit' $ 4.2.36 3 502---> exit exit $ 4.2.36 5 504---> echo $SHLVL 1 $ 4.2.36 6 505--->
BASH_VERSINFO A readonly array variable
commandline session
$ 4.2.36 2 501---> echo BASH_VERSINFO[0]
BASH_VERSINFO[0]
$ 4.2.36 3 502---> echo $BASH_VERSINFO[0]
4[0]
$ 4.2.36 4 503---> echo $BASH_VERSINFO
4
$ 4.2.36 5 504---> echo $BASH_VERSINFO[1]
4[1]
$ 4.2.36 6 505---> echo BASH_VERSINFO[1]
BASH_VERSINFO[1]
$ 4.2.36 7 506---> echo "BASH_VERSINFO[1]"
BASH_VERSINFO[1]
$ 4.2.36 8 507---> echo BASH_VERSINFO(1)
bash: syntax error near unexpected token `('
$ 4.2.36 8 508---> echo BASH_VERSINFO[4]
BASH_VERSINFO[4]
$ 4.2.36 9 509---> echo $BASH_VERSINFO[4]
4[4]
$ 4.2.36 10 510---> echo ?BASH_VERSINFO[4]
?BASH_VERSINFO[4]
$ 4.2.36 11 511---> echo !BASH_VERSINFO[4]
bash: !BASH_VERSINFO[4]: event not found
$ 4.2.36 11 511---> echo ?BASH_VERSINFO[4]
?BASH_VERSINFO[4]
$ 4.2.36 12 512--->
