General :: Explanation Of Here Scripts As Well As The "cat" Command
Aug 13, 2011
I am currently in the very early stages of learning how to use the shell and write scripts (and I mean really early- only been at it for 3 days or so). Now I am following a tutorial, and I have reached a section about the so-called "here scripts" or "here documents".
[Code]...
Now what I don't understand is how those two scripts, once run, produce the same output.. I believe this is because I don't understand the "cat"-command (which is not quite useful, considering it seems to be a very practical and widely used command).
So would anyone care to explain to me what it does in this specific script as well as alternative applications? (And please refrain from just quoting the man-pages.. I have read them multiple times, and I still just don't get it - It's probably very simple,
View 11 Replies
ADVERTISEMENT
Jun 2, 2011
I need explanation for top command. If ran the TOP command,on top it shows few options like
[Code]..
View 3 Replies
View Related
Jun 10, 2010
I'm trying to learn to rename files with the command line, and after browsing around a lot of pages I finally found a command that uppercases the first letter of a file, but the problem is that I want to understand the meaning of each command. The command is:
for i in *; do new=`echo "$i" | sed -e 's/^./U&/'`; mv "$i" "$new";done
I understand the 'for' kinda... but not the 'echo' or '`' and especially the sed command.
View 4 Replies
View Related
Apr 8, 2011
what block size means in plain English? I know block size 4k has 2 TB of file size limit and 1024 has around 17 GB. How do they calculate this?
View 3 Replies
View Related
Jun 10, 2010
Back when I was first learning Linux, one of the questions that I kept wondering about was "what are all these files and directories for?" I couldn't find a resource that would explain them in a digestible manner. Specifically, I was looking for one that would allow me to look at a Linux filesystem interactively, collapsing and expanding folders to look at just the ones I was interested in at the moment. So later, when I got the opportunity, I wrote it.
But despite a ton of research, I'm still not totally knowledgeable on the subject. The most important thing I'm looking for right now is for experienced Linux/Unix people to tell me where I got stuff wrong, and for newbies to tell me how useful it is to them and which things need clarification. I'm also interested in technical and graphical ways to improve usability, like better icons, layout, etc. I know I need to be able to collapse long descriptions, but what would you like to see? The Works Cited list and a full introduction are still on the way as of this writing.
Without further ado: Linux Filesystem Hierarchy Explanation. You'll need a fairly recent browser that can handle XSLT; the actual info is stored as XML, and transformed into HTML with an XSLT stylesheet. This is still a work in progress, and I'll be updating it as the thread progresses.
Finally, would people be interested in collaborating with me on this, as an open-source project? I've never done anything like that, and I'm not sure how much time I'll be able to give it in the future, but I really think this should be continued and expanded.
Edit: Works Cited and decent intro are now in place.
View 3 Replies
View Related
Mar 12, 2010
My family have three Linux operated ACER ONE netbooks, all of them need the new Firefox 3.6 download as the old format wont be supported supposedly by ..... etc. I have downloaded the SOFTWARE but cant get it to run, the Firefox explanation mentions lots of files etc that are cant access, nor can I excecute any files once they have been extracted. The same happens with any software but Iv ignored it till now, not having a "modern" browser will make things difficult. I need it explaining simply. On another subject can anyone use facebook chat on Linux
View 6 Replies
View Related
Jul 16, 2010
So I was trying to remotely access my XP laptop from my Ubuntu laptop. I read up on tsclient and rdesktop and tried both methods. For example, in the terminal, I typed:
rdesktop <host ip>
However, this came back with the following error:
autoselected keyboard map en-us.
ERROR: <host ip>: unable to connect.
After a bit of internet searching, I found the solution to the keyboard problem. I typed:
rdesktop -k en-us <host ip>
This yielded the following error:
ERROR: <host ip>: unable to connect.
No clarification, no explanation. nothing. Does anyone have any ideas?
View 1 Replies
View Related
Mar 26, 2011
I know my way around MS Windows much better, but I just don't feel right trying to program something for Android on a Microsoft operating system. I am interested in Android programming so I followed the instructions on [URL] to install the environment on my computer...
I just installed the JDK, SDK, Eclipse successfully (or I assume):
* When I get to Step 4 where I'm supposed to run 'android' it will not run. I get the error message "android: command not found" (I am definitely in the right directory).
** When I double-click it in nautilus, it opens up in gedit. I can set the permissions in nautilus (through the properties - Allow executing file as a program) and get it to work,
My system:
Intel i7
Ubuntu 10.10 Maverick Meerkat
android-sdk-linux-x86
eclipse 3.6.2
View 5 Replies
View Related
Jul 3, 2009
I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?
View 4 Replies
View Related
Apr 30, 2011
I installed the Berkeley DB on the Ubuntu server and tried to access the dbxml from the command line and it returns command not found
path/to/dir/dbxml-2.5.16/install/bin$dbxml
-bash" dbxml: command not found
Can someone point me in the right direction
View 1 Replies
View Related
Jul 21, 2010
I want to be able to use Ctrl+R to have reverse-i search. Also if I press Shift+Up Arrow after typing the first few characters of a recently executed command then the shell should complete the command by finding the most recent commmand having the same first few characters.
View 1 Replies
View Related
Jun 7, 2010
Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT.However, I'm wondering if there is a way to log the commands to a file as soon as the Return key is pressed, e.g. before starting the command and not on completion of the command (using the COMMAND_PROMPT option would save the command once the prompt is there again).
I read about auditing programs like snoopy and session recorder like script but I thought they're already too complex for the simple question I have. I guess that deactivating that script logs all the output of the command would lead already in the right direction but isn't there a quicker way to solve that probelm?
View 1 Replies
View Related
Apr 14, 2011
When you run the following cp command in the BASH terminal, how does Linux know which files are the source and which are the destination when copying multiple files from one location to another?How does Linux know that the services, motd, fstab, and hosts files are the source and the /home/fred/my_dir is the destination?This question came up in a Linux class and I was not sure of the answer. I was thinking it is based on the source path entered ending with a file path and the destination being a directory, but was not sure.
View 4 Replies
View Related
Nov 20, 2009
i'm trying to redirect the output of a command to the input of the next command. not sure if i'm going about this the right way. an easy method would be just to store the output of the previous command in a file and redirect input to read that file, but i'm curious to see if this can be done without writing to any files.
View 9 Replies
View Related
Mar 20, 2011
Possible Duplicate: What does this cryptic bash command mean? Why this command crashes Linux? :(){ :|:& };:
View 4 Replies
View Related
May 9, 2011
Up until now I've been using plink to remotely compile a project I'm working on. But recently the administrator from the remote server updated the distribution and messed up some configurations. My project has a lot of scripts written for tc shell (tcsh), and now the default shell is bash. There is no way to change this. Another problem is that now I need to run newgrp to change my default user group.
So... to work around this problem I've changed my .bashrc to run newgrp and then tcsh. If I do a normal connection using SSH, everything works as expected, but when using plink, or SSH to remotely execute commands, the shell gets stuck on the newgrp command. I think it's because both applications need a return value from newgrp to send the command I need to execute. Remotely running scripts that call a shell also get stuck like newgrp (newgrp also opens a new shell and that's why it gets stuck) my .bashrc is as follows:
Code:
user_grp=`id -g`
if [ $user_grp != 4919 ]; then
newgrp new_group_id
else
[code]....
View 4 Replies
View Related
Apr 4, 2011
i want in the website they ask to enter some input.Code:echo -e "<p>Please Enter Year : c</p> "read Yearif i use this command it will ask the user to enter year in command. but what i want is they ask the user to enter year in web browser.
View 14 Replies
View Related
Apr 29, 2010
i want to disable the su command on a server so that users cant run the su command i removed the comment from the 3 and 5 line in /etc/pam.d/su file but it doesnt seem to work the file is shown below
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
[code]....
View 8 Replies
View Related
May 31, 2010
What's the command to delete bash command history?
View 4 Replies
View Related
Aug 19, 2009
I have a script which builds a project and then runs junit tests. However, if the build fails, the junit tests fail with the same error message.Therefore the command which runs the junit tests should only be executed if the build was successful.
View 3 Replies
View Related
Jul 2, 2011
I want to run gsettings list-schemas (which return a list of about 100 names separated by spaces)and somehow direct each name one at a time as the input to this command:gsettings list-recursivelyI've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input butam missing something in between I'm sure like for - while or proper syntax of awk etc
View 3 Replies
View Related
Nov 13, 2010
I want to use the output of a previous command as a parameter to another command. For example: to know where "nice" is stored i typed: which nice output: /usr/bin/nice now the second command i typed is: ls -l /usr/bin/nice Is there a way to have a single command like: ls -l which nice ?
View 4 Replies
View Related
Oct 14, 2010
How do I use the "history" command to fire the last run command?
View 3 Replies
View Related
Jun 24, 2011
how do you write the ASCII character #27 in the vim command line?
View 6 Replies
View Related
Feb 18, 2010
I have a file and it has some content . Now I want to check for some text in that file and if does not exist I want to append it . So I need to first grep and then do "echo "content" >> s.txt" . Is there any way to execute this two commands in a single command .
View 3 Replies
View Related
Jun 30, 2010
Im not getting able to neither add new users using command useradd nor delete existing users using command userdel. And even Im not getting able to login into any existing users except root. It was ok before. Im having this problem very recently on my linux server. Im using RHEL5.
View 9 Replies
View Related
Apr 6, 2010
I'm timing how long it takes to run a command foo. I'm looking to append the results from the time command to a file, and discard the results from the foo command. I tried the following, but it didn't do what I want:
$ time ./foo > /dev/null >> output_from_time_command.txt
View 1 Replies
View Related
Feb 23, 2010
I am doing some embeded linux work in ARM 9263.So I need to make a image for that board.But when I using one command "make uImage" I am getting the following error.
make: arm-linux-gcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
HOSTCC scripts/basic/fixdep
code....
View 4 Replies
View Related
Aug 18, 2009
I want to run a linux command with apache through web browser and that's is not working. and it's working properly when I execute this command through terminal, where is the problem?
NOTE: apache have the privileges to execute the command
View 7 Replies
View Related
Sep 8, 2010
I want to scan a particular directory recursively and run a particular command with each file as input. For this I am using "find /dir/path". I dont want to write any long script containing loop on the output of "find". I want a single command which will allow me to run a command on each file of the "find" command output.
View 3 Replies
View Related