I'm trying to use the dirs command with the +N option. The manual says: dirs [-clpv] [+n] [-n]Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Direc- tories are added to the list with the pushd command; the popd command removes entries from the list. +n Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero.
dirs -v shows:
0 /dir1/
1 /dir2/
2 /dir3/
However, dir +n 1, dir +N 1, dir -v +n 1, dir -v +N 1 all give:
I have to format 4 years worth of awstats data "static" for a client and then move it to their new server.I don't want to run the commend to do this 48 times. If possible I would like to use a bash script that uses the folders in a directory so the script knows which year-month to do this for me and which folder to place the output in.
suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).
I am searching a GUI based "tree view utility" which shows me which directories consume how much hard disc space (cumulative, including recursively the sub directories; including hidden files). Is there such a tool fur Ubuntu/Linux and how do I install it? Is there at least a cmdline command which does the same job in terminal window?
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code: #!/bin/bash cat > ~/generateGridmix2data.sh << END
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?
$ ls one.tar.gz one.tar.gz $ tar -xvfz one.tar.gz tar: z: Cannot open: No such file or directory tar: Error is not recoverable: exiting now $ tar -xvzf one.tar.gz one $ tar -xzvf one.tar.gz one $ tar -zxvf one.tar.gz one $
i've an issue in a firewall command i hope u help me on.when i try to type the following firewall command:iptables -A INPUT -s xxx.xxx.xxx.xxx -dport 8000:9000 -p tcp -j ACCEPTit gives me:Bad argument `8000:9000`it complaints about the port range and i cant see in problems in that.i also tried to change the order of the options but it never worked.one other thing,why it don't allow me to add -sport option in the above command?
For example I have "/some/dir" which contains user's files and directories. I want to check if there are any files or directories of root. I guess I should use "find" command but what's the full command to find it out?
In the rpm manual, Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display. But actually, there're not enough hash marks when I'm installing a package. About 44 hash marks there...Well, I just want to know where the `50 hash marks' are.
Trying to write a shell script called make to read a file called dirs with the following in it programs scripts documents Read file line by line and make the directories in the current directory when you type ./make dirs if no file is given then program should print usage: make dirs filename
I am writing a shell script that unzips a ZIP file into an existing hierarchy of files, potentially overwriting some of the files. The problem is that the unzip command asks for confirmation: replace jsp/extension/add-aspect.jsp? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
This is unacceptable for a script.I need an option to force unzip to overwrite the files.I did not find in the man page nor with Google.
I tried to install gfortran on my computer. When I extract the tarball, I forgot the '-C' option of the command 'tar', which should be added, according to the instruction of installation.
That is to say, I wrote in the mp directory:
Then, the tarball creates a '/usr' directory under '/tmp' directory, and it contains only a /local directory, which contains only a /gfortran directory.
The thing is, when I modify the name of this directory, for example, from /usr to /usr-modi, I found that the name of the directory /usr under the root directory is also changed from /usr to /usr-modi.
How can I delete this annoying /usr directory under /tmp, without tragically affect /usr under the root directory?
I am trying to automate an svnadmin dump command for a backup script, and I want to do something like this:
find /var/svn/* ( ! -name dir -prune ) -type d -exec svnadmin dump {} > {}.svn ;
This seems to work, in that it looks through each svn repository in /var/svn, and runs svnadmin dump on it.
However, the second {} in the exec command doesn't get substituted for the name of the directory being processed. It basically just results a single file named {}.svn.
I suspect that this is because the shell interprets > to end the find command, and it tries redirecting stdout from that command to the file named {}.svn.
I have one distro installed, LILO as the boot loader, and i wonder if it's possible to duplicate the lilo entries with an option which executes some script or command during, or after the boot.Actually, i installed a Slackware + autolaunching virtual machine, but i have two VM, so i need to autolaunch one of them. May i choose it from the very beginning ?
What does the following Shell program do ??: () { :| : &} ; :Warning: My computer got hung when i tried to execute this.Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!
Code: i=0 while [ $i -lt $ARRAYLEN ]; do if ["$META1" = "$array"]; then META1FLAG=1 else META1FLAG=0 fi let i++ done While $array contains a word like "start"
When I run the script, In the terminal I either get the response: myscript.sh: line 3: [: missing ']' or if $META1 contains the same word "start, I get: myscrit.sh: line 3: [start: command not found
The purpose of the script is to evaluate a parameter that a user might include when they invoke my script, and compare it to some data that $META1 might contain. If they match I want to set a flag and later launch Xine. If they do not match, I want to set a flag to zero and do something else. I'm a bit lost as to what the responses are trying to tell me in the terminal window when I run this script.
I am looking for a way to delete the currently entered commandline without wasting seconds on the "Backspace"-key.
For example I scrolled the bash history and have a long commandline that would execute when I pressed ENTER:
~$ aptitude search openssl | grep dev
But now I decide that I do not want to execute this command. Can I get an empty prompt fast without deleting the whole line with Backspace? On the Windows "cmd" you can just press ESCAPE and it is gone. This behavior would be what I want.
The question may seem trivial but this is bothering me for a long time now.
I am reading the output of /proc/acpi/thermal_zone/ATF0/temperature in a program to read my CPU temp. I am using cat like the following:
Code: #cat /proc/acpi/thermal_zone/ATF0/temperature temperature: 49 C
I basically want to get rid of the spaces in between temperature and the actual temperature. Is there a command I can pipe the cat output to, to remove the spaces. I have seen suggestions for sed, or tr, but for some reason I cannot get them to work properly.
I open up 2 xterms on my desktop, A(/dev/pts/0) and B(/dev/pts/1).I can write from A to B using redirection e.g. echo "test" > /dev/pts/1How do I run a command from A on B? e.g. "clear"Basically I'm putting the 2 terminals side by side, and using terminal B to display the contents of the current working directory, by running the following in A:export PROMPT_COMMAND="ls -a > /dev/pts/1"but this fills up the screen pretty fast. I was actually looking for a way to clear up the second terminal.