LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-23-2011, 06:11 PM   #16
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by grail View Post
markush's response is the correct one here. Try it for yourself and see what happens. Create three files starting with the letter g and see what
happens when you issue the command.
To do this won't I have to create some g files? Every time I try to write code and try to execute I always get this cannot access: no such file or directory.
 
Old 07-23-2011, 06:13 PM   #17
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by kenny53067 View Post
I understand this 100%
I'm trying to understand what things do so that I will be able to write code.

example: I didn't know that ls Memo would not work, but ls Memo? would list all files with Memo in the name. Now I know.
Ummm - that's actually wrong.

Code:
$ ls
Memo1  Memo10  Memo11  Memo12  Memo13  Memo14  Memo2  Memo3  Memo4
Code:
$ ls Memo?
Memo1  Memo2  Memo3  Memo4
Code:
$ ls Memo??
Memo10  Memo11  Memo12  Memo13  Memo14


Cheers,
Tink
 
Old 07-23-2011, 06:18 PM   #18
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
Hello,

@kenny53067, it seems you're posting from a Windows-computer. If you don't have Linux running, you should either boot a live-CD or use for example Virtualbox and install a Linux-distribution as a virtual machine. Then you can try out the code.

Markus
I have a VMware player and it has Fedora. There are no files on it so it is hard to run a script. As a matter of fact I have the terminal open the same time as this window.

Not to get off the subject, but is there a way to make the virtual machine stop turning off when is idle for to long?
 
Old 07-23-2011, 06:25 PM   #19
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tinkster View Post
Ummm - that's actually wrong.

Code:
$ ls
Memo1  Memo10  Memo11  Memo12  Memo13  Memo14  Memo2  Memo3  Memo4
Code:
$ ls Memo?
Memo1  Memo2  Memo3  Memo4
Code:
$ ls Memo??
Memo10  Memo11  Memo12  Memo13  Memo14


Cheers,
Tink
Let me see if I understand, $ ls This list all files?

$ ls Memo? only list Memo with single digit numbers?

$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
 
Old 07-23-2011, 06:31 PM   #20
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
You should in a terminal execute the following command (in your home-directory where you have write-permissions!!!)
Code:
for files in {1..20}; do touch Memo$files; done
this will create the files Memo1 up to Memo20, use them for some exercises.

Markus
 
1 members found this post helpful.
Old 07-23-2011, 06:33 PM   #21
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by kenny53067 View Post
Let me see if I understand, $ ls This list all files?

$ ls Memo? only list Memo with single digit numbers?

$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
No, this is not correct, the questionmark means any single character, it would also match for example "Memos".

Markus
 
1 members found this post helpful.
Old 07-23-2011, 06:34 PM   #22
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by kenny53067 View Post
Let me see if I understand, $ ls This list all files?

Is this correct?
Yep.

Quote:
Originally Posted by kenny53067 View Post
$ ls Memo? only list Memo with single digit numbers?

Is this correct?
Almost. It will work w/ ANY character, not just digits.

Quote:
Originally Posted by kenny53067 View Post
$ ls Memo?? only list Memo with double digit numbers?

Is this correct?
See one above.



Cheers,
Tink
 
1 members found this post helpful.
Old 07-23-2011, 06:49 PM   #23
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
You should in a terminal execute the following command (in your home-directory where you have write-permissions!!!)
Code:
for files in {1..20}; do touch Memo$files; done
this will create the files Memo1 up to Memo20, use them for some exercises.

Markus
Done, now I have Memo1-Memo20 files. Why is there a Memo1 and a Memo1~
 
Old 07-23-2011, 06:51 PM   #24
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Did you edit it? the vim editor for example creates a backupfile once you've made changes to a file, the backupfile has a "~" at it's end.

Markus
 
1 members found this post helpful.
Old 07-23-2011, 07:03 PM   #25
kenny53067
Member
 
Registered: Jul 2011
Location: Rio Grande City, Texas
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by markush View Post
Did you edit it? the vim editor for example creates a backupfile once you've made changes to a file, the backupfile has a "~" at it's end.

Markus
So these are the same file, one is the original and one is a back-up.
 
Old 07-23-2011, 07:52 PM   #26
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
So these are the same file, one is the original and one is a back-up.
If one is the original and the other a back-up they can't be
the same, technically speaking ;}


Cheers,
Tink
 
Old 07-24-2011, 01:59 AM   #27
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by kenny53067 View Post
So these are the same file, one is the original and one is a back-up.
The backup is made in the moment when you "could" have changed the file, which means you changed the text and wrote the changed file to the disk.

So both files can have the same content, but they are not the same like a symlink.

Markus
 
Old 07-24-2011, 11:59 AM   #28
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
ls does not list all files and directories, it does not list "hidden" files, that is those with first character .

To list all files and directories use ls -a
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help writing a script... linux_evangelist Linux - Newbie 7 11-15-2010 08:19 AM
Need help writing script Rustylinux SUSE / openSUSE 1 12-05-2006 11:05 AM
Script writing help, somebody? cwwilson721 Slackware 6 05-19-2006 10:40 PM
Writing a Script Nyc0n Linux - General 2 05-27-2002 08:21 PM
writing a Script spanky5125 Linux - Security 5 01-08-2002 10:22 AM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration