Posts Tagged ‘shell’

Some Useful Unix File Finding Commands

Some Useful Unix File Finding Commands
Following are some bunch of commands that might be useful if you want to find files in unix/linux.Large Files Find files larger than 10MB in the current directory downwards...find . -size +10000000c -lsFind files larger than 100MB...find . -size +100000000c -lsOld Files Find files last modified over 30days ago...find . -type f -mtime 30 -lsFind files last ...

Unix Shell Script Line Ending & Executable Issue with Subversion

Unix Shell Script Line Ending & Executable Issue with Subversion
Unix File Line Ending always gives you problem if you have your development environment in Windows and servers in Unix. Also if you are using Subversion as source control system then you need to be very careful about line endings.I had this issue where a shell script was deployed on Unix machine. But I was not able to run the shell script. It gave error:$> ...

Replace Text in Variables & Single/Multiple-Files in UNIX

Replace Text in Variables & Single/Multiple-Files in UNIX
Shell Script is fun. I love it when I know which commands to use. There are almost thousands ofHere is a simple trick to Replace Text and Variables in Files in UNIX. We will use command sed - it is very useful to find and replace text in single or multiple files.Replace Text in Single ...

Shell Script to Rename & Move files in Unix

Problem Statement: I have few files in source directory. I have to move them to another destination directory. The source directory have *.txt files that needs to be moved to destination directory. The destination filename should be *.txt.backup.So how to accomplish the above task in Unix Shell Script?Well the solution is simple:cd source/ for file in *.txt do mv "${file}" ../destination/"${file}.backup"Run a loop for each ...

Generate Random Number in UNIX Shell Script

Generate Random Number in UNIX Shell Script
RANDOM is a peculiar shell variable, but useful nonetheless. Peculiar because its value changes each time it is referenced (yes, this is by design).As you may have already guessed, RANDOM is a random number generator. The number generated is an integer between 0 and 32767, and can come in handy when writing shell scripts. ...

How to execute a command prompt command & view output in Java

How to execute a command prompt command & view output in Java
The basic part is very easy. To do this, we will use the Runtime’s exec method. The code would be like:Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("ping localhost");The command (I’ve used “ping localhost” ) can be anything that your command prompt recognizes. It will vary on UNIX and Windows environment.Now comes the bit where you would ...

How to: Reset MySQL root password

Resetting the root password of a MySQL database is trivial if you know the current password if you don't it is a little trickier. Thankfully it isn't too difficult to fix, and here we'll show one possible way of doing so.If you've got access to the root account already, because you know the password, you can change it easily:gaurav@gaurav:~$ mysql --user=root --pass mysql Enter password:mysql> update ...

Conversion of text file in PDF and vice versa in UNIX

Yes, this is also a good solution. All you need is to add:\documentclass{article} \begin{document} .... your original text goes here ... \end{document}after that call pdflatex youFIle.tex in your shell script.
Tags: , ,
Copyright © 2012 ViralPatel.net. All rights reserved.