Tag Archive: Computer file

In our previous post “using a file as a storage device” adrian asked a question to us : is it possible to extend the size on the ‘filename’ file? We searched on it and figured out the answer.  Let’s roll🙂

Lets say you create a file name /newfile of size 200MB and format it, after a while you want to extend the file size. To do that do the following

Step 1. Lets say you want to increase the file size by 100MB

dd   oflag=append  conv=notrunc  if=/dev/zero  of=/newfile   bs=1MB count=100

Now, the file is 100MB larger.

Step 2. Run file system check on the file

fsck -f /newfile

Step 3. Now if you formatted the file system in ext2,3 or 4, you can resize it by using

resize2fs  /newfile.

If you are unable to understand this post fully , please visit using file as a storage device first and check out the comments too . Thanks to adrian for comment🙂

Pages : Follow ankurtwi on Twitter      

We can classify all of the Linux/Unix commands into two types- Internal And External. Internal commands are the shell built-in commands while external commands are  files present in the $PATH. (Remember we treat everything in the Linux as a file). Commands like pwd, cd ,echo comes under the category of the  internal commands while ls,cp etc comes in the other category. To check whether the command is internal  or external we will use the typeutility (type itself is internal one). Just type the name of the command after the utility and it will return you something like this –

Using Type Utility

If you got a message like “cd is a shell builtin” after the execution of the command  it is an internal command. If you got something else it comes under the category of external commands (like cp in this case).

How Execution  Takes Place : For the external commands, execution is possible  only if the command file is present in the locations mentioned in the $PATH. Otherwise it will give you an error.If the command file is available  , but the path to that file is not included in the PATH variable, it will show you an error. Internal commands don’t need files for their execution. Set of internal commands is stored in shell by default. Sometimes a command with the same name exist in both the categories. Example – echo (external one lies in the /bin/echo) . In this case shell will give preference to the  internal echo first, then comes the turn of the external ones.  So if you use the echo utility internal will get executed. External echo rarely gets executed (You can execute it in the shell  by creating a subshell though).

Pages : Follow ankurtwi on Twitter      

%d bloggers like this: