Useful Commands

Windows simple setup file maker

Start>Run>iexpress

Rename multiple files/ Remove characters from beginning of a file name

# for f in monitor*; do mv “$f” “${f#monitor}”;done

Send a command error to file

The following command will put linux command error output to a file.

mv /tmp/dfa /record/ 3>&1 1>&2 2>&3 | tee /tmp/stderr.txt

If  /tmp/dfa does not exists you will get following line in /tmp/stderr.txt file

mv: cannot stat `/tmp/dfa’: No such file or directory

Find Text in a folder 

grep -lir “text to find” *

Steps to Reverse SSH:

 client : Is the Server which is behind nat and  you want to access it without altering firewall configuration.

 Server: Is the machine which can be accessed through WAN(internet).

  1. On the client run the following commands:
    $ mkdir -p $HOME/.ssh
    $ chmod 0700 $HOME/.ssh
    $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''

    This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).

  2. Copy $HOME/.ssh/id_dsa.pub to the server.
    scp ~/.ssh/id_dsa.pub server:
  3. On the server run the following commands:
    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
    $ chmod 0600 $HOME/.ssh/authorized_keys2

    Depending on the version of OpenSSH the following commands may also be required:

    $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
    $ chmod 0600 $HOME/.ssh/authorized_keys

    An alternative is to create a link from authorized_keys2 to authorized_keys:

    $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys
  4. On the client test the results by ssh’ing to the server:
    $ ssh -i $HOME/.ssh/id_dsa server
  5. (Optional) Add the following $HOME/.ssh/config on the client:
    Host server
             IdentityFile ~/.ssh/id_dsa

    This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

  6. Test the connectivity by ssh. It should not ask for password.
    ssh user@server -p 8022
  7. Put the below command in client’s /etc/rc.local
    nohup ssh -f -N -R 10000:localhost:22 user@server -p 8022
  8. To access the client run following command from the server.
    ssh user@localhost -p 10000

Unzip Multiple files with full path

#for z in *.zip; do 7za x -o/mnt/oebs/oracle/ $z;  done

If you are using command unzip use "unzip $z" instead of  "7za x -o/mnt/oebs/oracle/ $z;"
Another Option
#!/bin/bash
for zipfile in `ls /mnt/c/zipfiles/*.zip`; do unzip -o $zipfile -d /extracted/;
done
linux Find physical memory module installed in each memory slot
dmidecode --type 17
Enable x86 processors to access more than 4 GB of physical memory for Windows

Windows Server 2003 and Windows XP/2000:  To enable PAE, use the /PAE switch in the boot.ini file. To disable PAE, use the /NOPAE switch. To disable DEP, use the /EXECUTE switch.

bcdedit /set  pae ForceEnable

PAE is only used in 32 bit Windows versions. 32 GB is the limit for 64 bit Windows 2003 Standard Edition.

In 32-bit Windows running on x64-based systems, PAE also enables several advanced system and processor features, including hardware-enabled Data Execution Prevention (DEP), non-uniform memory access (NUMA), and the ability to add memory to a system while it is running (hot-add memory).

, , , , , , , , , , , , , , , , , , , , , , , , ,

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.