Linux current directory list display - linux

I know how to list contents of the current directory with one entry per line using this command:
$ ls -1
However, i don't know how to simultaneously display the contents one screen at a time. I've tried using the less command but i haven't had any success so far.
Any help much appreciated.

Related

how can i create a splitted variable output for a bash program, like htop does to show variable outputs on different sections of the terminal

im trying to write a bash script and i want it to be able to divide the screen in 2 sections and show a message on one of them and the output of a command in the other without having to split the terminal window just like htop or nvtop. I looked it up everywhere and im not getting a place to start.
top segment:
echo "now we are executing x command"
bottom segment:
sudo apt update -y
#above command's output
blablablablabla updating this and that
updated
your repositories work
blablablablabla
image for reference :
htop divisory lines
i looked everywhere on google and couldnt get a starting point, I also search for a way to leave a static header on the terminal with the command output refreshing underneat but still no luck finding something useful
Your reference image is for bashtop
That github project code would likely give you hints on how to proceed for what you want.

vim ~/.ssh/config command isn't showing any results

I'm using windows 10 ,I want to get into the SSH file but whenever I type "vim ~/.ssh/config" into my Git Bash the result I get is this
but the result I'm trying to get is supposed to look like the ones are showing in this second picture:
Can someone tell me how to get those results in my command ?
If the second picture is a file you already have on your disk, you need to copy it to your %USERPROFILE%\.ssh folder (since %USERPROFILE% is what git bash uses by default as $HOME or ~)
If the second picture is a file you want to have, then you need to create it.

Locating files starting with a string for my hw

I have a conundrum and I am not necessarily trying to cheat or anything I am just simply stuck. I am trying to complete an assignment for my intro to Linux class and I was hoping someone would be able to help me find the right solution. I have to:
In the same directory (where the last file was found) list all files
starting with "host" --
Use the long listing format Use a command to
find the file that shows the name of your computer
now the directory in question is /etc and I have tried several commands to no avail for both of these but especially the first one. I have tried find and locate and even attempted a grep and it just is not working as intended. I can't get files that start with "host" at most I keep getting a list of permission denied or files that end in .host and so I am not sure what I am doing wrong but I really need help so I can turn in my assignment. You don't have to tell me what the exact command should be I am just looking for some guidance again I am not trying to cheat just need help to figure it out.
and welcome to Stack Overflow! Here are some pointers.
See globbing in Linux and the * symbol.
"long listing" is an option for ls command, see ls --help. The name of your computer (or, more accurately, the name of your host) is a file in /etc/. You should see it when doing #1.

How less command shows output on stdout

I tried less command to view files in a zip file and to my surprise when I was done with the output, all my previous screen data was still present (which is not the case if i use more command for viewing a file content).
how does less command able to do this ?
Please refer the below images for more information..
before running the less command below is the terminal content,
After running the less command below is the terminal content,
How is less able to retain the terminal information unlike other commands like cat or more or zcat ?!
Any reference on this would also be of great help !
Thanks in advance..

Download batch files from a website using linux

i want to downloads some files (nearly about 1000-2000 zip files) from a website.
i can sit around and add each file one after another. please give me a program or script or whatever method so i can automate the download.
The website i am talking about has download link as
sitename.com/sometetx/date/12345/folder/12345_zip.zip
date can be taken care of. the main concern is that number 12345 before and after the folder, they both change simultaneously. e.g.
sitename.com/sometetx/date/23456/folder/23456_zip.zip
sitename.com/sometetx/date/54321/folder/54321_zip.zip
i tried using curl
sitename.com/sometetx/date/[12345-54321]/folder/[12345-54321]_zip.zip
but it makes to much of combination of downloads i.e. keeps left 12345 as it is and scan through 12345 to 54321 the increment left 12345 +1 then repeats scan from [12345-54321].
also tried bash wget
here i have one variable at two places, when using loop the right 12345 with a " _" is ignored by the program.
PLease help me, i dont know much about linux or programing, thanks
In order to get your loop variable next to _ to not be ignored by the shell, put it in the quotes, like this:
$ for ((i=10000; i < 99999; i++)); do \
wget sitename.com/sometetx/date/$i/folder/"$i"_zip.zip; done

Resources