Browse Docs

๐Ÿ—’๏ธ Sessions

Register your session

Useful to keep a trace, or to document and share what has been done.

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

asciinema : save the terminal session as a video.

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

Terminal

/etc/DIR_COLORS.xterm defines the terminal colors. dircolors changes the colors in the ls output.

Define the terminal:

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

Communicate with other sessions

  • Send a message to all people connected 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<type your message>  
3Ctrl + d 
  • Accept messages or not on your terminal: mesg <y or n>. finger - if there is a *, it means the user refuses to receive messages.

  • by mail

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

TTY / STTY

when you are on ksh on some old systems, nothing is defined. So you need to map it yourself:

 1# list all possible stty settings
 2stty -a    
 3
 4# make Backspace erase 
 5stty erase [the backspace key] [Enter]   
 6
 7# everything you type is not visible
 8stty -echo
 9
10# get the visibility back
11stty echo 

Profiles

/etc/profile - common to all users.
~/.profile - user’s profile, executed if .bash_profile does not exist.
/etc/bash.bashrc or ~/.bashrc - interactive non-login shells (when a terminal is opened or the bash command).
~/.bash_profile - executed at login to the shell.
TMOUT=300 - session timeout.
source .bashrc - reload .bashrc.

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

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

Alias definition

 1# define an alias
 2alias  ll=`ls -lrt`;  
 3
 4# chained command
 5alias  my_script=`cd /the/dir/of/my/script; ./my_script;  cd -`; 
 6
 7alias                  # List all aliases ongoing
 8type <alias_name>      # give some info on an alias
 9alias <alias_name>     # give the content of an alias
10unalias <alias_name>   # delete an alias

Sources

Blog

Sunday, October 4, 2026 Tuesday, August 1, 2023