Register your session

Usefull to keep a track or document and share what have been done.

script : save all commandes and result in a “typescript” file.
script -a : append to an existing “typescript” file (otherwise erase previous one).
exit : to stop session.

asciinema : save the terminal session in video.

For RHEL - something like Tlog exists and can be configure and centralised with Rsyslog.

Terminal

/etc/DIR_COLORS.xterm define terminal colors dircolors change colors in the ls output

Define terminal:

1# Activate vi
2set -o vi
3
4# Desactive vi
5set +o vi           
6
7# Activate emacs
8set -o emacs 

Communicate with other sessions

  • Send a message to all connected people to the server:
1wall    
2< write your message >   
3Ctrl +d
  • Send a message to a specific user (ttyp2 or pts/1 or getty):
1write <user> ttyp2   
2<taper son message>  
3Ctrl +d 
  • Accept message or not on your terminal mesg <y or n>. finger if there is a * mean the user refuse to receive message.

  • by mail

1uuencode test.txt test.txt | mailx -s "test" toto@example.com                           # mail with attach file (mailx > 12.x)
2uuencode test.txt test.txt; mailx -a test.txt -s "test" toto@example.com < /dev/null    # mail with attach file (mailx < 12.x)

TTY / STTY

when you are in ksh on some old system nothing is define. So you need to map by yourself:

 1# list all stty possible
 2stty -a    
 3
 4# make Backspace touch erase 
 5stty erase [la touche backspace] [Enter]   
 6
 7# everything what you type is not visible
 8stty –echo
 9
10# get the visibilty back
11stty echo 

Les Profiles

/etc/profile - common to all users.
~/.profile - user´s profile execute if .bash_profile does not exist.
/etc/bash.bashrc or ~/.bashrc - interactif non-login Shells. ( when terminal is open or bash cmd).
~/.bash_profile - executed when login to Shell.
TMOUT=300 - session TimeOut.
sources .bashrc - Reload .bashrc.

when you want .bashrc to trigger all the time, to put in .bash_profile:

1if [ -f ~/.bashrc ]; then
2   source ~/.bashrc
3fi

Definition des Alias

 1# define an alias
 2alias  ll=`ls -lrt`;  
 3
 4# cumule command
 5alias  mon_script=`cd /le/repertoire/de/mon/script; ./mon_script;  cd -`; 
 6
 7alias                  # List all aliases ongoing
 8type <alias_name>      # give some info on alias
 9alias <alias_name>     # give content of an alias
10unalias <alias_name>   # delete an alias

Sources

Blog