Feeds:
Posts
Comments

Archive for the ‘linux command’ Category

Screen, this command might not be well known to many people but but its one of those programs that you just can’t stop using once you’ve started. Previously I used VNC to connect the remote servers, but now i have stopped using VNC. Now I am using SCREEN on a regular daily basis and it’s really easy to use.

Screen program provides the following functionality:

  • Remote terminal session management (detaching or sharing terminal sessions)
  • Unlimited windows (unlike the hardcoded number of Linux virtual consoles)
  • Scrollback buffer (not limited to video memory like Linux virtual consoles)
  • Copy/paste between windows
  • Split terminal (horizontally) into multiple regions
  • Locking other users out of terminal
  • Screen is an easy way to allow processes to continue running after the session is terminated, if you lose connection screen will save your spot

Following is the content of my ~/.screenrc file
************************************************************
startup_message off
vbell off
caption always “%{= bb}%{+b w}%n %h %=%t %c”
hardstatus alwayslastline “%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<”
activity “Activity in %t(%n)”
shell -/bin/bash
************************************************************
Screen Commands

screen Start screen

screen -x Connect to an existing screen session

screen -d detaching a screen session

screen -r reattaching the screen session

Ctrl+a c New window

Ctrl+a n Next Window

Ctrl+a p Previous Window

Ctrl+a ” Select window from list

Ctrl+a Ctrl+a Previous window viewed

Ctrl+a <0-9> Select the numbered window

Ctrl+a A Set window title

Ctrl+a K Kill window

Ctrl+a d Detach screen from terminal

Ctrl+a x Lock Session

Ctrl+a : Goto screen command prompt

Ctrl+a ? Show key binding/command names

Ctrl+s Pause the output on screen

Ctrl+q Resume the output on screen

Read Full Post »

Linux Cut command

Cut Command
————

Divide a file into several parts (columns)

syntax:
cut [-b] [-c] [-f] list [-n] [-d delim] [-s] [file]

Examples:
——–

1. Let say you have a file test.txt which has colon(:) seperated data

406378:Sales:Itorre:Jan
031762:Marketing:Nasium:Jim
636496:Research:Ancholie:Mel
396082:Sales:Jucacion:Ed

If you want to print first set of data from each row, you can use cut command as follow:

cut -d”:” -f1 test.txt

If you want to print just columns 1 to 6 of each line (the employee serial numbers), use the -c1-6 flag, as in this command

cut -c1-6 test.txt

Read Full Post »