0% found this document useful (0 votes)
34 views

Useful Shell Commands

The document provides instructions for several Linux/Unix commands and operations: 1) It describes how to generate an SSH key pair and add the public key to the server's authorized_keys file to enable SSH login with a private key. 2) It lists commands for finding USB devices, searching and replacing text in files and folders, removing CVS files, refreshing font caches, comparing directories, checking CVS history, and dropping non-primary database indexes.

Uploaded by

mimi_tantono
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Useful Shell Commands

The document provides instructions for several Linux/Unix commands and operations: 1) It describes how to generate an SSH key pair and add the public key to the server's authorized_keys file to enable SSH login with a private key. 2) It lists commands for finding USB devices, searching and replacing text in files and folders, removing CVS files, refreshing font caches, comparing directories, checking CVS history, and dropping non-primary database indexes.

Uploaded by

mimi_tantono
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

How to Connect to SSH with Private Key on client machine, generate a pair of private key and public key:

ssh-keygen -t dsa it will generate a pair of private and public keys in: ${user.home}/.ssh/id_dsa ${user.home}/.ssh/id_dsa.pub add the public keys to server's ${user.home}/.ssh/authorized_keys create the file if it's not existed. Mount USB /sbin/fdisk -l mount -t vfat -v /dev/sdb /media/MI-MEE/ Find and Replace cat filename | sed -e '/text/newtext/g' Find and Replace in a Folder cd /app/conf for y in `ls *`; do sed -e 's/10.32.6.244/10.32.15.164/g' $y > temp; mv temp $y; done Remove CVS files: find . -name CVS -prune -exec rm -rf {} \; Refresh font cache: fc-cache -f -v Compare 2 directories: comm <(ls ~/dir-new/) <(ls ~/dir) Check CVS history: cvs -d :pserver:[email protected]:/cvs/cvs-documentation log -R yudi-doc/ Drop index keys of a database (except PRIMARY key): #!/bin/sh db=$3 user=$1 pswd=$2 mysql -u$user -p$pswd -e "show tables from $db"| awk '{if(NR>1) print "show index from "$1";"}'| mysql -u$user -p$pswd $db| awk '{if($3 !~ /Key_name/ && $3 !~ /PRIMARY/) print $1" "$3}'| awk '{print "alter table "$1" drop index "$2";"}' GIT

You might also like