i have some questions about the commands

Jiye

New Member
Joined
Nov 21, 2020
Messages
4
Reaction score
0
Credits
48
I'm doing a job and I have a question with the commands in Linux, first of all I don't understand much about Linux, it's the first time I've used it. The question is, with the command ls -la as I indicate what specific directory I want to look at, for example if I want to look at the desktop directory, how I write it. Is it ls -la / desktop, or is it ls -the desktop and also another question if I write ls, all that is shown on the screen are directories? And if so, could I see them using the ls command, right?
 


lets try an experiment:

open up a terminal and type:

bash-5.0$ cd ~
bash-5.0$ pwd
// i get : /home/andrew
bash-5.0$ cd desktop
iget : bash: cd: desktop: No such file or directory
bash-5.0$

bash-5.0$ cd Desktop
bash-5.0$ pwd
/home/andrew/Desktop

On my system desktop is "Desktop"

if i wanted to list contents of Desktop i would cd to Desktop then :

( i dont think i will be displaying any secrets)

Code:
bash-5.0$ ls -al
total 3212
drwxr-xr-x 6 andrew users 4096 Nov 23 09:19 .
drwx------ 60 andrew users 106496 Nov 23 09:51 ..
-rw-r--r-- 1 andrew users 183378 Nov 7 10:07 .config
-rw------- 1 andrew users 81 Nov 7 13:03 .directory
drwxr-xr-x 3 andrew users 4096 Jul 16 04:50 CI4-userguide-4.0.4
-rw-r--r-- 1 andrew users 2709992 Oct 19 13:06 codeigniter4foundations.pdf
drwxr-xr-x 2 andrew users 4096 Nov 23 09:19 passwordstested
-rw-r--r-- 1 andrew users 118 Nov 22 20:55 slackware.html~
-rw-r--r-- 1 andrew users 250362 Nov 10 2019 southend.jpg
drwxr-xr-x 2 andrew users 4096 Nov 19 17:06 testImages
drwxr-xr-x 2 andrew users 4096 Nov 17 11:09 webPlay
 
OK i see now, hahahahaha. im so sorry for ask this idiot questions... and thank you. Now i have another question there is a question that said wrait in the terminal the command
hexdump -C < file.c , and ask wath happen and other command
date >> something.txt , that ask the same.
i try it to put in the terminal changing the file.c with some file that end with .c from my computer and i do the same with something.txt. but nothing happen. i dont know if i put something bad (probably) or its just a fake question for try and answer it writting nothing happen. Maybe this is another idiot question but i dont know, (sorry again if it is)
thanks


 
i think its fair to say , on this site we will help you if we can.

There are no silly questions , we've all been there !
 
hexdump -C < file.c

that is putting the contents of file.c through command hexdump with flag canonical

a > goes left to right

so :
bash-5.0$ date > /home/andrew/Desktop/info.txt
//above outputs response of command date and puts it in file info.txt

contents of info.txt after running command:


Mon Nov 23 11:55:42 GMT 2020
 
OK i see now, hahahahaha. im so sorry for ask this idiot questions... and thank you. Now i have another question there is a question that said wrait in the terminal the command
hexdump -C < file.c , and ask wath happen and other command
date >> something.txt , that ask the same.
i try it to put in the terminal changing the file.c with some file that end with .c from my computer and i do the same with something.txt. but nothing happen. i dont know if i put something bad (probably) or its just a fake question for try and answer it writting nothing happen. Maybe this is another idiot question but i dont know, (sorry again if it is)
thanks

Hexdump is a command that can dump/display the contents of files in hexadecimal. Its -C option is the "Canonical" option which displays the content of the file in hex and ASCII.
The < operator is a redirection operator which redirects the content of file.c as an input to the hexdump command.

Note: You don't NEED to use input redirection with hexdump. You can also just specify the file like this:
Bash:
hexdump -C file.c

Which does exactly the same thing.

The date command you have posted uses output redirection to redirect the output of the date command to a file called something.txt.
Your command uses two redirection operators >> which will redirect the output to a new file called something.txt - OR - if something.txt already exists, the output from date is appended to the end of the file.

Whereas if the output of date was redirected using a single redirection operator > then it will redirect the output to a new file called something.txt - OR - if something.txt already exists, the existing file will be completely overwritten.

So there is a subtle difference between redirecting output via >> and >.
 
ok i undrstand thanks, and now souprise sourprise i have more question,its about write a command that show all the files in the actual directory that have a,b,j,e in the extension. i tought it was something like this
ls/a*.{a,d,e,j}
but wasnt this, i think is similar. someone know the command?
 

Staff online

Members online


Top