Category: unix
-
Unix – tar – package and compress files and directory
Create an archive To create an archive of the entire test directory, issue the following command: tar cvf my_arch.tar /home/oracle/alex/test Compress the Files or Directory with gzip tar cvf – filenames | gzip > file.tar.gz Compress the Files or Directory with bzip2 tar cvf – directorypath | bzip2 > file.tar.bz2 If you want to include…
-
Unix – Grep, egrep and Recursive Grep
# files containing “import” in subdirectories grep -rHn “import” * # files containing “import” or “except” grep -rHnE “import|except” * # only .py files containing “import” or “except” grep –color –include=”*.py” -rHnE “import|except” * # python files, text files and java files grep –color –include=”*[py|txt|java]” -rHnE “^import [a-z,\s]+$” * # same as above with extended…
-
bzip2 – compress and decompress
Compress Files using bzip bzip2 archivefile1.txt Folder Compression The “.bz2” file extension is commonly used by the compression program bzip2, which is the counter part of bunzip2. You can use the “-r” option to recursively compress all the files under the specified directory. For example: tar cvf – foldername | bzip2 > foldername.tar.bz2 Keeping the…
-
Unix – Set date and time
sudo date -s “01/18/2013 17:18:00” # Fri Jan 18 17:18:00 CET 2013 sudo date -s “YYYY-mm-DD HH:MM:SS-MS:00” Example: sudo date -s “2013-01-16 13:57:56-06:00” > man date DATE(1) User Commands DATE(1) NAME date – print or set the system date and time SYNOPSIS date [OPTION]… [+FORMAT] date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]] DESCRIPTION Display the current time in the…
-
Unix – find files and directories using the find and grep commands
Find Files containing solr # python files, text files and java files grep –color –include=”*[py|txt|java]” -rHnE “^import [a-z,\s]+$” * # same as above with extended find . -regextype posix-extended -iregex “.*.py|.*.txt|.*.txt” -exec grep –color -rHnE “import|except” ‘{}’ \; -print #find . -name “*.py” -exec grep –color -rHnE “import|except” ‘{}’ \; -print Find Files containing solr…
-
Ubuntu Upgrading from 12.04(Precise Pangolin) to 12.10(Quantal Quetzal)
Here’s how I upgraded to Ubuntu 12.10 from 12.04 sudo do-release-upgrade -d References http://www.unixmen.com/how-to-upgrade-from-uabuntu-1004-1010-1104-to-ubuntu-1110-oneiric-ocelot-desktop-a-server/