Sunday, September 12, 2010
LXSplit - A simple tool for splitting and joining split files
Friday, October 31, 2008
SPLIT AND JOIN FILES
To split it to be a small size so its fit to store in USB is easy in linux platform, use "split" command which has been bundled in GNU Coreutils.
1. As example, we have an iso file (ubuntu-8.04-desktop-i386.iso) which size is 699 Mb
root@hardy:/home/bearisusanto/test# ls -alh
total 700M
-rwx------ 1 bearisusanto root 700M 2008-06-02 03:22 ubuntu-8.04-desktop-i386.iso
2. Before doing split process, first make MD5 file from ubuntu-8.04-desktop-i386.iso for ensuring that there is not a change for the file when its join again
root@hardy:/home/bearisusanto/test# md5sum ubuntu-8.04-desktop-i386.iso > MD5SUM.txt
root@hardy:/home/bearisusanto/test# cat MD5SUM.txt
8895167a794c5d8dedcc312fc62f1f1f ubuntu-8.04-desktop-i386.iso
3. For splitting ubuntu-8.04-desktop-i386.iso to be a file which the size maximal 400Mb for each file, we type the command
root@hardy:/home/bearisusanto/test# split -d -b 400m ubuntu-8.04-desktop-i386.iso ubuntu-8.04-desktop-i386.iso.part
4. If we check in the directory, there is two 2 which is the result from splitting process
-rwx------ 1 bearisusanto root 700M 2008-06-02 03:22 ubuntu-8.04-desktop-i386.iso
-rw-r--r-- 1 root root 400M 2008-10-31 23:13 ubuntu-8.04-desktop-i386.iso.part00
-rw-r--r-- 1 root root 300M 2008-10-31 23:13 ubuntu-8.04-desktop-i386.iso.part01
5. To join the two file to be one file as the same with the original file, we use "cat" command but the original have to be deleted first.
root@hardy:/home/bearisusanto/test# rm ubuntu-8.04-desktop-i386.iso
root@hardy:/home/bearisusanto/test# cat ubuntu-8.04-desktop-i386.iso.part00 ubuntu-8.04-desktop-i386.iso.part01 > ubuntu-8.04-desktop-i386.iso
6. For ensuring that there is no difference with the original file, we have to validate with using MD5SUM.txt which have made for the first time.
root@hardy:/home/bearisusanto/test# md5sum -c MD5SUM.txt
ubuntu-8.04-desktop-i386.iso: OK
Thursday, October 23, 2008
Creating, Moving, Renaming and Deleting Files and Directories
1. Creating new directories using “mkdir”
Pronounce the mkdir command as “make dir”
root@hardy:/home/bearisusanto/Documents# mkdir NEWDIR
root@hardy:/home/bearisusanto/Documents# ls
NEWDIR
If you try to create a directory with name has already been used, it will shows
root@hardy:/home/bearisusanto/Documents# mkdir NEWDIR
mkdir: cannot create directory `NEWDIR’: File exists
2. Copying files to new locations using “cp” and “mv”
Pronounce cp as “sea pea”, similarly, pronounce mv as “em vee”, but when you speak of moving a file, say “move”
Copy files “
root@hardy:/home/bearisusanto/Documents/NEWDIR# cp login login.copy
root@hardy:/home/bearisusanto/Documents/NEWDIR# ls -ld login login.copy
-rw-r–r– 1 root root 20 2008-07-29 11:43 login
-rw-r–r– 1 root root 20 2008-07-29 11:43 login.copy
Copy Folder
root@hardy:/home/bearisusanto/Documents# cp NEWDIR NEWDIR01
cp: omitting directory `NEWDIR’
Note : Generally, UNIX won’t permit to use the cp command to copy directories
Not as “cp” where leaves the original file intact, making sort of electronic equivalent of a photocopy of a paper, “mv” physically relocates them from the old directory to the new
root@hardy:/home/bearisusanto/Documents# mv login /home/bearisusanto/Documents/TEST
root@hardy:/home/bearisusanto/Documents# mv TEST01 /home/bearisusanto/Documents/TEST
root@hardy:/home/bearisusanto/Documents# cd TEST/
root@hardy:/home/bearisusanto/Documents/TEST# ls
login TEST01
3. Renaming files with mv
“mv” command, whic, in essence, moves the old name to the new name. It’s a bit confusing, but it works
root@hardy:/home/bearisusanto/Documents/TEST# ls
login TEST01
root@hardy:/home/bearisusanto/Documents/TEST# mv login test
root@hardy:/home/bearisusanto/Documents/TEST# ls
test TEST01
root@hardy:/home/bearisusanto/Documents/TEST#
4. Removing directories with rmdir
root@hardy:/home/bearisusanto/Documents/TEST# rmdir TEST01
root@hardy:/home/bearisusanto/Documents/TEST# ls
test
5. Removing Files Using rm
root@hardy:/home/bearisusanto/Documents/TEST# rm test
root@hardy:/home/bearisusanto/Documents/TEST# ls
root@hardy:/home/bearisusanto/Documents/TEST#
Sunday, October 12, 2008
LISTING FILES
- Linux command used to list the files in a given directory
- Most common method for displaying files
- Displays all the files in the current directory in columnar format
• "ll" command
- Alias for the ls -l command
- Gives a long file listing
• File command
-Linux command that displays the file type of a specified filename
• Text file
- File that stores information in a readable text format
• Some filenames inside each user’s home directory represent important configuration
files or program directories
• Hidden files
– Files that are not normally displayed to the user via
common filesystem commands
List option :
-a or --all = list all filenames
-A or --almost-all = List most filenames (excludes the . and .. special files)
-C = lists filenames in column format
--color=n = list filenames without sorting
-f = lists all filenames without sorting
-F or --classify = lists filenames classified by file type
--full-time = lists filenames in long format and displays the full modification time
-l = lists filenames in long format
-lh or -l --human-readable = lists filenames in long format with human-readable (easy-to-read)
-lG or -l --no-group or -o = lists filenames in long format but omits the group information
-r or --reverse = list filenames reverse sorted
-R or --recursive = lists filenames in the specified directory and all subdirectories
-s = lists filenames and their associated size in kilobytes (K)
-S = lists filenames sorted by file size
-t = lists filenames sorted by modification time
-U = lists filenames without sorting
-x = lists filenames in rows rather than in columns
Saturday, October 11, 2008
Finding Files
which
The first is the which(1) command. which is usually used to locate a program quickly. It just searches your PATH and returns the first instance it finds and the directory path to it. Take this example:
% which bash
/bin/bash
From that you see that bash is in the /bin directory. This is a very limited command for searching, since it only searches your PATH.
whereis
The whereis(1) command works similar to which, but can also search for man pages and source files. A whereis search for bash should return this:
% whereis bash
bash: /bin/bash /usr/bin/bash /usr/man/man1/bash.1.gz
This command not only told us where the actual program is located, but also where the online documentation is stored. Still, this command is limited. What if you wanted to search for a specific configuration file? You can’t use which or whereis for that.
find
The find(1) command allows the user to search the filesystem with a rich collection of search predicates. Users may specify a search with filename wildcards, ranges of modification or creation times, or other advanced properties. For example, to search for the default xinitrc¤ FORMTEXT
file on the system, the following command could be used.
% find / -name xinitrc
/var/X11R6/lib/xinit/xinitrc
find will take a while to run, since it has to traverse the entire root directory tree. And if this command is run as a normal user, there will be permission denied errormessages for directories that only root can see. But find found our file, so that’s good. If only it could be a bit faster...
slocate
The slocate(1) command searches the entire filesystem, just like the find command can do, but it searches a database instead of the actual filesystem. The database is set to automatically update every morning, so you have a somewhat fresh listing of files on your system. You can manually run updatedb(1) to update the slocate database (before running updatedb by hand, you must first su to the root user). Here’s an example of slocate in action:
% slocate xinitrc # we don’t have to go to the root
/var/X11R6/lib/xinit/xinitrc
/var/X11R6/lib/xinit/xinitrc.fvwm2
/var/X11R6/lib/xinit/xinitrc.openwin
/var/X11R6/lib/xinit/xinitrc.twm
We got more than what we were looking for, and quickly too.With these commands, you should be able to find whatever you’re looking for on your Linux system.