list only five files per archive recursively : ssh [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using below command to get the detailed list of files in each archive in a particular directory. unzip -l ".zip". But the problem with this command is that it is enlisting all the files in the archive. I want to limit the number of files to be listed to 5 per archive.
I am using ssh. Thanks.:)

you can either use head or tail to limit the top n line or bottom n line
unzip -l a.zip | head -n 5

Related

Efficient way of using auto complete in Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Guys What is a more efficient way of doing the following using auto-complete?
cd
ls
cd bar
ls
cd baz
ls
cd basilio
Try ls -R from the outermost folder, that will recursively list all content.
You haven't specified in which SHELL. In BASH you can do double-tab to see what are your options:
cd [TAB] [TAB] type first few letters [TAB] to complete.
Similar - but better - completion is implemented in ZSH.

Linux: copy all files using the * wildcard that contain the word file [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've worked all night on this, but haven only solved part of the problem. I am trying to copy all files using the * wildcard that contain the word file in the filename into the work directory.
try doing this :
cp *file* ./work/
cp *file* work/
Is this homework?

reading filenames from a file and moving files from one location to other in Unix [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have one file which contains filenames.
I want read those filenames from that file and move them to particular location.
awk '{old=$0;new=/path/pathsub/;system("mv \""old"\" "new)}' your_file_with_file_list
You can use a simple loop:
#!/bin/bash
while read -r filename;
do
mv "$filename" /DESTINATION/PATH/
done < input_filename

Is there any good tool to manage bash history? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Wanting to remember some impotant cmds, I used to put them in .bashrc_history file and use search to find, like:
$ history | grep alias | grep coffee | grep code
but sometimes history may lost for some reason. Also, usually several terminals, which may rewrite the history.. So is there any tool to manage?
Put this into your ~/.bashrc and re-login (or source the ~/.bashrc)
prompt_command() {
history | sed '$!d' >> /path/to/some/file
}
PROMPT_COMMAND=prompt_command
Now every command you type will be appended to /path/to/some/file immediately after you type it

How to make Linux shell command stack store only unique commands [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I just reformated my HD and had to overwrite my /home partition. Everything is fine in Linux Mint 11.
Except that the command stack recall with cursor up/down displays repeats of the same command.
Like:
ls
ls
ls
cd ~
should be:
ls
cd ~
Any ideas how to fix this?
Assuming you're using bash:
export HISTIGNORE="&"
I assume you're using bash.
Add this to to your ~/.bashrc
HISTCONTROL=ignoreboth

Resources