Installing AWS CLI version 2 on Windows

Preview Evaluation Software

AWS CLI version 2 is provided as a preview for testing and evaluation. At this time we recommend that you do not use this in a production environment. For production environments, we recommend that you instead use the generally available version 1.x.

Prerequisites for Windows

  • The AWS CLI version 2 is supported on Microsoft Windows XP or later.
  • The AWS CLI version 2 supports only 64-bit versions of Windows.

Installing on Windows

For Windows users, the MSI installation package offers a familiar and convenient way to install the AWS CLI version 2 without installing any other prerequisites.

To install the AWS CLI version 2 using the MSI installer

  1. Download the MSI installer.
  2. Run the downloaded MSI installer and follow the onscreen instructions. By default, the CLI installs to C:\Program Files\Amazon\AWSCLI2.NoteThe preview release of AWS CLI version 2 names the program aws2 to enable AWS CLI version 1 and version 2 to coexist side-by-side. Future releases of AWS CLI version 2 might change this command name.
  3. To confirm the installation, use the aws2 --version command at a command prompt (open the Start menu and search for cmd to start a command prompt).
C:\> aws2 --version
aws-cli/2.0.0dev0 Python/3.7.3 Windows/10 botocore/2.0.0dev0

Don’t include the prompt symbol (C:\>, shown above) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the CLI. The rest of this guide uses the generic prompt symbol, $ , except in cases where a command is Windows-specific.

If Windows is unable to find the program, you might need to close and reopen the command prompt to refresh the path, or add the installation directory to your PATH environment variable manually.

Upgrading on Windows

The AWS CLI is updated regularly. Check the Releases page on GitHub to see when the latest version was released.

To update to the latest version, download the latest version of the MSI installer and run it, as described previously. It automatically overwrites the previous version.

Removing from Windows

To uninstall the AWS CLI, open the Control Panel, and then choose Programs and Features. Select the entry named AWS Command Line Interface, and then choose Uninstall to launch the uninstaller. Confirm that you want to uninstall the AWS CLI when you’re prompted.

You can also launch the Programs and Features program from the command line with the following command.

c:\> appwiz.cpl

when user login through terminal, automatically an email send to owner

$ sudo apt-get update
$ sudo apt install mailutils
$ sudo systemctl restart postfix

Put the following in /etc/profile:

if [ -n "$SSH_CLIENT" ]; then 
    TEXT="$(date): ssh login to ${USER}@$(hostname -f)" 
    TEXT="$TEXT from $(echo $SSH_CLIENT|awk '{print $1}')" 
    echo $TEXT|mail -s "ssh login" adityaypi@yahoo.com 
fi

How the script works

/etc/profile is executed at every login (for bash shell users). The if statement will only return true if the user has logged in via ssh, which in turn will cause the indented code block to be run.

Next, we then build the text of the message:

  • $(date) will be replaced by the output of the date command
  • ${USER} will be replaced by the user’s login name
  • $(hostname -f) will be replaced by the full hostname of the system being logged into

The second TEXT line adds to the first, giving the IP address of the system this user is logging in from. Finally, the generated text is sent in an email to your address.

$ sudo /etc/init.d/ssh restart
$ sudo service ssh restart
$ sudo restart ssh
$ sudo systemctl restart ssh

SUMMARY OF LESS COMMANDS

Less command is linux utility which can be used to read contents of text file one page(one screen) per time. It has faster access because if file is large, it don’t access complete file, but access it page by page.

For example, if it’s a large file and you are reading it using any text editor, then the complete file will be loaded to main memory, but less command don’t load entire file, but load it part by part, which makes it faster.



      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.
      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.

  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.
 ---------------------------------------------------------------------------

                           MOVING

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Right one half screen width (or N positions).
  ESC-(  LeftArrow  *  Left  one half screen width (or N positions).
  ESC-}  ^RightArrow   Right to last column displayed.
  ESC-{  ^LeftArrow    Left  to first column.
  F                    Forward forever; like "tail -f".
  ESC-F                Like F but stop when search pattern is found.
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.
 ---------------------------------------------------------------------------

                          SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
ESC-u                Undo (toggle) search highlighting.
  &pattern          *  Display only matching lines
        ---------------------------------------------------
        A search pattern may be preceded by one or more of:
        ^N or !  Search for NON-matching lines.
        ^E or *  Search multiple files (pass thru END OF FILE).
        ^F or @  Start search at FIRST file (for /) or last file (for ?).
        ^K       Highlight matches, but don't move (KEEP position).
        ^R       Don't use REGULAR EXPRESSIONS.
 ---------------------------------------------------------------------------

                           JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).
  t                 *  Go to the (N-th) next tag.
  T                 *  Go to the (N-th) previous tag.
  {  (  [           *  Find close bracket } ) ].
  }  )  ]           *  Find open bracket { ( [.
  ESC-^F <c1> <c2>  *  Find close bracket <c2>.
  ESC-^B <c1> <c2>  *  Find open bracket <c1>
        ---------------------------------------------------
        Each "find close bracket" command goes forward to the close bracket
          matching the (N-th) open bracket in the top line.
        Each "find open bracket" command goes backward to the open bracket
          matching the (N-th) close bracket in the bottom line.

  m<letter>            Mark the current position with <letter>.
  '<letter>            Go to a previously marked position.
  ''                   Go to the previous position.
  ^X^X                 Same as '.
        ---------------------------------------------------
        A mark is any upper-case or lower-case letter.
        Certain marks are predefined:
             ^  means  beginning of the file
             $  means  end of the file
 ---------------------------------------------------------------------------

                        CHANGING FILES

  :e [file]            Examine a new file.
  ^X^V                 Same as :e.
  :n                *  Examine the (N-th) next file from the command line.
  :p                *  Examine the (N-th) previous file from the command line.
  :x                *  Examine the first (or N-th) file from the command line.
  :d                   Delete the current file from the command line list.
  =  ^G  :f            Print current file name.
 ---------------------------------------------------------------------------

                    MISCELLANEOUS COMMANDS

  -<flag>              Toggle a command line option [see OPTIONS below].
  --<name>             Toggle a command line option, by name.
  _<flag>              Display the setting of a command line option.
  __<name>             Display the setting of an option, by name.
  +cmd                 Execute the less cmd each time a new file is examined.

  !command             Execute the shell command with $SHELL.
  |Xcommand            Pipe file between current pos & mark X to shell command.
  s file               Save input to a file.
  v                    Edit the current file with $VISUAL or $EDITOR.
  V                    Print version number of "less".
 ---------------------------------------------------------------------------

                           OPTIONS

        Most options may be changed either on the command line,
        or from within less by using the - or -- command.
        Options may be given in one of two forms: either a single
        character preceded by a -, or a name preceded by --.

  -?  ........  --help
                  Display help (from command line).
  -a  ........  --search-skip-screen
                  Search skips current screen.
  -A  ........  --SEARCH-SKIP-SCREEN
                  Search starts just after target line.
  -b [N]  ....  --buffers=[N]
                  Number of buffers.
  -B  ........  --auto-buffers
                  Don't automatically allocate buffers for pipes.
  -c  ........  --clear-screen
                  Repaint by clearing rather than scrolling.
  -d  ........  --dumb
                  Dumb terminal.
 -D [xn.n]  .  --color=xn.n
                  Set screen colors. (MS-DOS only)
  -e  -E  ....  --quit-at-eof  --QUIT-AT-EOF
                  Quit at end of file.
  -f  ........  --force
                  Force open non-regular files.
  -F  ........  --quit-if-one-screen
                  Quit if entire file fits on first screen.
  -g  ........  --hilite-search
                  Highlight only last match for searches.
  -G  ........  --HILITE-SEARCH
                  Don't highlight any matches for searches.
  -h [N]  ....  --max-back-scroll=[N]
                  Backward scroll limit.
  -i  ........  --ignore-case
                  Ignore case in searches that do not contain uppercase.
  -I  ........  --IGNORE-CASE
                  Ignore case in all searches.
  -j [N]  ....  --jump-target=[N]
                  Screen position of target lines.
  -J  ........  --status-column
                  Display a status column at left edge of screen.
  -k [file]  .  --lesskey-file=[file]
                  Use a lesskey file.
  -K            --quit-on-intr
                  Exit less in response to ctrl-C.
  -L  ........  --no-lessopen
                  Ignore the LESSOPEN environment variable.
  -m  -M  ....  --long-prompt  --LONG-PROMPT
                  Set prompt style.
  -n  -N  ....  --line-numbers  --LINE-NUMBERS
                  Don't use line numbers.
  -o [file]  .  --log-file=[file]
                  Copy to log file (standard input only).
  -O [file]  .  --LOG-FILE=[file]
                  Copy to log file (unconditionally overwrite).
  -p [pattern]  --pattern=[pattern]
                  Start at pattern (from command line).
  -P [prompt]   --prompt=[prompt]
                  Define new prompt.
  -q  -Q  ....  --quiet  --QUIET  --silent --SILENT
                  Quiet the terminal bell.
  -r  -R  ....  --raw-control-chars  --RAW-CONTROL-CHARS
  Output "raw" control characters.
  -s  ........  --squeeze-blank-lines
                  Squeeze multiple blank lines.
  -S  ........  --chop-long-lines
                  Chop (truncate) long lines rather than wrapping.
  -t [tag]  ..  --tag=[tag]
                  Find a tag.
  -T [tagsfile] --tag-file=[tagsfile]
                  Use an alternate tags file.
  -u  -U  ....  --underline-special  --UNDERLINE-SPECIAL
                  Change handling of backspaces.
  -V  ........  --version
                  Display the version number of "less".
  -w  ........  --hilite-unread
                  Highlight first new line after forward-screen.
  -W  ........  --HILITE-UNREAD
                  Highlight first new line after any forward movement.
  -x [N[,...]]  --tabs=[N[,...]]
                  Set tab stops.
  -X  ........  --no-init
                  Don't use termcap init/deinit strings.
  -y [N]  ....  --max-forw-scroll=[N]
                  Forward scroll limit.
  -z [N]  ....  --window=[N]
                  Set size of window.
  -" [c[c]]  .  --quotes=[c[c]]
                  Set shell quote characters.
  -~  ........  --tilde
                  Don't display tildes after end of file.
  -# [N]  ....  --shift=[N]
                  Horizontal scroll amount (0 = one half screen width)
      ........  --no-keypad
                  Don't send termcap keypad init/deinit strings.
      ........  --follow-name
                  The F command changes files if the input file is renamed.
      ........  --use-backslash
                  Subsequent options use backslash as escape char.


 ---------------------------------------------------------------------------

                          LINE EDITING

 These keys can be used to edit text being entered
        on the "command line" at the bottom of the screen.

 RightArrow ..................... ESC-l ... Move cursor right one character.
 LeftArrow ...................... ESC-h ... Move cursor left one character.
 ctrl-RightArrow  ESC-RightArrow  ESC-w ... Move cursor right one word.
 ctrl-LeftArrow   ESC-LeftArrow   ESC-b ... Move cursor left one word.
 HOME ........................... ESC-0 ... Move cursor to start of line.
 END ............................ ESC-$ ... Move cursor to end of line.
 BACKSPACE ................................ Delete char to left of cursor.
 DELETE ......................... ESC-x ... Delete char under cursor.
 ctrl-BACKSPACE   ESC-BACKSPACE ........... Delete word to left of cursor.
 ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
 ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
 UpArrow ........................ ESC-k ... Retrieve previous command line.
 DownArrow ...................... ESC-j ... Retrieve next command line.
 TAB ...................................... Complete filename & cycle.
 SHIFT-TAB ...................... ESC-TAB   Complete filename & reverse cycle.
 ctrl-L ................................... Complete filename, list all.


Unix Less Command: Tips for Effective Navigation

The navigation keys in less command are similar to Vim editor. In this article, let us look at few less command navigation and other operations which will make you a better command line warrior.

1. Less Command – Search Navigation

Once you’ve opened a log file (or any file) using less file-name, use the following keys to search. Please note that the match will be highlighted automatically by default.

Forward Search

  • / – search for a pattern which will take you to the next occurrence.
  • n – for next match in forward
  • N – for previous match in backward

Backward Search

  • ? – search for a pattern which will take you to the previous occurrence.
  • n – for next match in backward direction
  • N – for previous match in forward direction

Tip: If you dont bother about which direction the search is happening, and you want to search file path, or URL, such as “/home/ramesh/”, you can use backward search (?pattern) which will be handy as you don’t want to escape slashes each time.

Search Path
In forward: /\/home\/aditya\/
In backward: ?/home/aditya/

2. Less Command – Screen Navigation

Use the following screen navigation commands while viewing large log files.

  • CTRL+F – forward one window
  • CTRL+B – backward one window
  • CTRL+D – forward half window
  • CTRL+U – backward half window

3. Less Command – Line navigation

In a smaller chunk of data, where you want to locate particular error, you may want to navigate line by line using these keys:

  • j – navigate forward by one line
  • k – navigate backward by one line

4. Less Command – Other Navigations

The following are other navigation operations that you can use inside the less pager.

  • G – go to the end of file
  • g – go to the start of file
  • q or ZZ – exit the less pager

5. Simulate tail -f inside less pager – Press F

Once you’ve opened a file using less command, any content that is appended to the file after that will not be displayed automatically. However, you can press F less command will show the status ‘waiting for data‘. This is as similar to ‘tail -f’.

6. Less Command – Count magic

Similar to Vim editor navigation command, you can give 10j to scroll 10 lines down, or 10k to go up by 10 lines.

  • 10j – 10 lines forward.
  • 10k – 10 lines backward.
  • CTRL+G – show the current file name along with line, byte and percentage statistics.

7. Other useful Less Command Operations

  • v – using the configured editor edit the current file.
  • h – summary of less commands
  • &pattern – display only the matching lines, not all.

8. Open any types of files using less command

less command can be used to open and view the following 10 different file types:

  1. PDF File – *.pdf
  2. Word Document- *.doc
  3. Image Files – *.gif, *.jpg, *.jpeg, *.png
  4. TAR Files – *.tar
  5. TAR Files with gzip – *.tar.gz
  6. Zip Files – *.zip
  7. Gzip and Gzip2 Files – *.gz and *.bz2
  8. ISO Files
  9. Debian Files – *.deb
  10. RPM Files – *.rpm

Set the LESSOPEN environment variable to lesspipe

First, make sure the following is set in the environment variable.

$ set | grep less
LESSOPEN='|/usr/bin/lesspipe.sh %s'

Please note that you can also do the following to setup the lesspipe.

$ eval "($lesspipe)"

$ cat ~/.bashrc
eval "($lesspipe)"
  • lesspipelessfile are the input preprocessor for less, which lets it to open all types of files.
  • lesspipe allows you to open while the process of conversion is going on using pipe.
  • lessfile completes the conversion first, and then displays the content. This writes the converted thing to a temporary file then displays it.
  • You can also write your own input preprocessor, and use it.

File Type 1: How to open a pdf file?

It shows all the text in the pdf file clearly, but ignores the images. The output may have some special characters here and there. But it is definitely readable.

File Type 1: How to open a pdf file?

It shows all the text in the pdf file clearly, but ignores the images. The output may have some special characters here and there. But it is definitely readable.

$ less Linux-101-Hacks.pdf
^LLinux 101 Hacks
www.thegeekstuff.com
o
o
o
Chapter 1: Powerful CD Command Hacks
cd is one of the most frequently used commands during a UNIX session.
The cd command hacks mentioned in this chapter will boost your productivity

File Type 2: How to open a word document file?

$ less pdb.doc
The Python Debugger Pdb
=======================

To use the debugger in its simplest form:

        >>> import pdb
        >>> pdb.run

The debugger's prompt is Pdb.  This will stop in the first
function call in

File Type 3: How to open a jpg, jpeg, png file?

While opening a image file (jpeg, jpg and png), less command shows the following information:

  • Name of the file
  • Type of file
  • Number of pixels — width & height
  • Size of the file
$ less testfile.jpeg
testfile.jpeg JPEG 2304x1728 2304x1728+0+0 DirectClass 8-bit 1.57222mb 0.550u 0:02

Note: Similar kind of information will be displayed for other image file types.

9. Less Command – Marked navigation

When you are viewing a large log file using less command, you can mark a particular position and return back to that place again by using that mark.

  • ma – mark the current position with the letter ‘a’,
  • ‘a – go to the marked position ‘a’.

10. Less Command – Multiple file paging

Method 1: You can open multiple files by passing the file names as arguments.

$ less file1 file2

Method 2: While you are viewing file1, use :e to open the file2 as shown below.

$ less file1
:e file2

Navigation across files: When you opened more than two files ( for e.g – less * ), use the following keys to navigate between files.

  • :n – go to the next file.
  • :p – go to the previous file.

Reduce system reboots and improve kernel security.

Canonical Livepatch Service

Apply critical kernel patches without rebooting.

  • Fixes are applied automatically, without restarting your system
  • Reduces downtime, keeping your Ubuntu LTS systems secure
    and compliant
  • Included as part of all Ubuntu Advantage for Infrastructure
    support packages

Livepatch is like a dream come true, both from a technical and a business standpoint. Our Ubuntu systems now rarely or never have to be rebooted. Service is continuous. That makes a big difference for user and customer satisfaction and loyalty.Masaaki Hirose, IT Platform Department, DeNA

Free for personal use

All you need is an Ubuntu One account. Free for 3 machines.

Get Livepatch

how to remove live patch from ubuntu

$ sudo snap remove canonical-livepatch

scrollbar css tricks

The scrollbar set of CSS properties is a proprietary style hook from Internet Explorer 5.5, which let designers create custom themes for the browser’s native scrollbars. Currently, it is exposed behind the -webkit vendor prefix for use in browsers using the Webkit (and Blink) rendering engine. This almanac entry is an overview, for a more complete breakdown of working with custom scrollbars, please read this CSS-Tricks article.

body::-webkit-scrollbar {
    width: 1em;
}
 
body::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
 
body::-webkit-scrollbar-thumb {
  background-color: darkgrey;
  outline: 1px solid slategrey;
}

The -webkit-scrollbar family of properties consists of seven different pseudo-elements that, together, comprise a full scrollbar UI element:

  1. ::-webkit-scrollbar addresses the background of the bar itself. It is usually covered by the other elements
  2. ::-webkit-scrollbar-button addresses the directional buttons on the scrollbar
  3. ::-webkit-scrollbar-track addresses the empty space “below” the progress bar
  4. ::-webkit-scrollbar-track-piece is the top-most layer of the the progress bar not covered by the draggable scrolling element (thumb)
  5. ::-webkit-scrollbar-thumb addresses the draggable scrolling element that resizes depending on the size of the scrollable element
  6. ::-webkit-scrollbar-corner addresses the (usually) bottom corner of the scrollable element, where two scrollbars might meet
  7. ::-webkit-resizer addresses the draggable resizing handle that appears above the scrollbar-corner at the bottom corner of some elements

How to Clear cache in Laravel

Many times you face an issue that any changes to the Laravel application are not reflecting on web interfaces. This occurred due to the application is being served by the cache. This tutorial will help you to clear cache in the Laravel application.

Clear Cache in Laravel (Terminal)

Log in to the system running your Laravel application and open a terminal. Then navigate to your Laravel application code. Here you can issue the commands to clear cache as followings:

1. Clear Application Cache

Run the following command to clear application cache of the Laravel application.

php artisan cache:clear

2. Clear route cache

To clear route cache of your Laravel application execute the following command from the shell.

php artisan route:cache

3. Clear config cache

You can use config:clear to clear the config cache of the Laravel application.

php artisan config:clear 

4. Clear compiled view files

Also, you may need to clear compiled view files of your Laravel application. To clear compiled view files run the following command from the terminal.

php artisan view:clear 

Clear Cache in Laravel (Browser)

Most of the shared hosting providers don’t provide SSH access to the systems. In that case, you can clear Laravel cache by calling URL in the browser. You can simply place the below code in your routes/web.php file of Laravel application. Then access this URL in the browser to clear the cache of Laravel application.

Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    return "Cache is cleared";
});

change mysql password

Stop the MySQL service

(Ubuntu and Debian) Run the following command:

sudo /etc/init.d/mysql stop

(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following command:

sudo /etc/init.d/mysqld stop

Start MySQL without a password

Run the following command. The ampersand (&) at the end of the command is required.

sudo mysqld_safe --skip-grant-tables &

Connect to MySQL

Run the following command:

mysql -uroot

Set a new MySQL root password

Run the following command:

use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

Stop and start the MySQL service

(Ubuntu and Debian) Run the following commands:

sudo /etc/init.d/mysql stop
...
sudo /etc/init.d/mysql start

(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following commands:

sudo /etc/init.d/mysqld stop
...
sudo /etc/init.d/mysqld start

Log in to the database

Test the new password by logging in to the database.

mysql -u root -p

Enter your new password when prompted.

How to Get a Sprint Call Log

A cell phone can usually retain a log of both incoming and outgoing calls. However, the handset’s call log is limited to a certain number of days, after which the entries automatically get deleted. To access a log that is not available on your phone, you can go to your Sprint account and access your phone’s call history. You will see the date, time, duration phone number and destination of each outgoing and incoming call.

Step 1

Go to Sprint’s website and log in to your account by entering your username and password. Once your account page opens, click the “My Account” tab.

Step 2

Click “See All Usage” at the bottom of the page.

Step 3

Click “See Call Log.” This will show you a detailed call log with each call made and received on the current billing cycle.

Step 4

Click “See my Bill” if you want to review the call log of the previous month.

How to Find a Server’s IP Address

The Internet protocol TCP/IP implies a unique IP address depicted in the dot-decimal form (such as 193.45.12.4) for every computer or server in the network. In the Internet, special domain name system (DNS) servers translate computer names into their IP addresses. Both Windows and Linux operating systems have simple commands for accessing the DNS service that allow you to find an IP address of any server worldwide.

In Windows XP/Vista/7

Step 1

Log on to a user account in Windows and go to the Start menu.

Step 2

Type “CMD” and press “Enter” to open the command prompt window in Windows Vista/7. Click “Run” and type “CMD” followed by pressing “Enter” in Windows XP.

Step 3

Type “nslookup” and press “Enter.” For instance, type “nslookup www.yahoo.com.”

Step 4

Read the command output. A line will contain the server’s name. In our example, the line contains “Name: www.yahoo.com.” The next line that begins with the word “Address” will include the the server’s IP address.

In Linux

Step 1

Click the GNOME menu “Applications” and “Accessories.” Then choose “Terminal” to open a command prompt window (terminal) in Linux.

Step 2

Type “host” and press “Enter.” For example, type “host www.amazon.com.”

Step 3

Read the server’s IP address in the command output. For instance, www.example.com has the IP address 144.5.210.250.