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 03-10-2005, 01:28 PM   #1
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Rep: Reputation: 30
How to open A file with an editor through my shell


After installing samba I need to configure my file in /etc/samba/smb.conf I can simply double click and open the file, How can I view the file using my shell .... for example Do i have to specify the name of editor before the file name in order to view the file...

eg.

root@Admin:/etc/samba# emacs smb.conf

Thanks.
 
Old 03-10-2005, 01:37 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 5, Linux Lite
Posts: 4,312

Rep: Reputation: 209Reputation: 209Reputation: 209
Yes put the name of the editor before the filename you wish to open.
 
Old 03-10-2005, 01:42 PM   #3
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Original Poster
Rep: Reputation: 30
Thanks .. Just to know what is the common text editor for linux? Meaning that I will find in every machine.
 
Old 03-10-2005, 02:03 PM   #4
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 31
I think that the answer for that is "vi". It would be in the 99% of the machines, nevertheless sometimes it is actually "vim" (vi improved) what you will run, even if you put "vi". The problem is that "vi" could be a little difficult in the beginning, so keep a browser handy to look how it works.

Other very common editors are "nano", "emacs" and "joe".
 
Old 03-10-2005, 02:22 PM   #5
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
slackware also have pico by default installed, which is really easy to use.
The command are displayed in the bottom of the pico.
^X means CTRL+X
Most distros have either pico or nano which is a GNU pico - clone, but the default UNIX editor is vi. vi in slackware is a link to elvis, which is a vi clone like vim. vim is also installed
Find a tutorial for vi. It's a really powerfull command-line editor.

Last edited by perfect_circle; 03-10-2005 at 02:25 PM.
 
Old 03-10-2005, 03:47 PM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Re: How to open A file with an editor through my shell

Quote:
Originally posted by amer_58
After installing samba I need to configure my file in /etc/samba/smb.conf I can simply double click and open the file, How can I view the file using my shell ....
If you really just want to look at the file, try
Code:
cat /etc/samba/smb.conf
the "cat" command conCATinates the file to the console. (The equivalent to the M$ "type" command.)

If you're actually configuring samba, check out (as root)
Code:
system-config-samba
or, better yet,
Code:
firefox localhost:901
if you have the SWAT service running on port 901 (its default). (Substitute your favorite browser for "firefox.")

See the "network" forum here for more info (and help)
 
Old 03-10-2005, 05:22 PM   #7
casttellum
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core X
Posts: 6

Rep: Reputation: 0
Also, if you have xwindows running, you can probaly use 'gvim **FILE TO EDIT**'. This will open a vim in a window. But: you might not have gvim installed and you must be logged in as either root or the user you are graphicaly logged in as.
 
Old 03-10-2005, 05:41 PM   #8
smiler
Member
 
Registered: Sep 2002
Distribution: Mandrake 10.0 O
Posts: 48

Rep: Reputation: 15
the easiest for me to work with right away is jed, but it is not installed by default.
There is a menusystem in the console so you don't have to remember commands
 
Old 03-11-2005, 12:57 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,396

Rep: Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395Reputation: 2395
Whichever editor you finally go with, I'd recommend learning at least the basics of 'vi', as it's pretty much guaranteed to be avail on any Unix/Linux/*BSD machine. You favourite may not be... and in commercial env's, you prob won't be allowed to download your own...
 
Old 03-11-2005, 01:49 AM   #10
amer_58
Member
 
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213

Original Poster
Rep: Reputation: 30
With the vi I can only view the file, I need to edit it as well.
 
Old 03-11-2005, 04:58 AM   #11
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
Quote:
Originally posted by amer_58
With the vi I can only view the file, I need to edit it as well.
No. This is why we are telling you that vi is not newbie friendly. To insert something before the letter the pointer is placed type the letter i (=insert). Then you enter in insertion mode and you can write. After you write you press Esc to leave insertion mode. The letter a (=append) will append something. You will enter in insertion mode and what you type will be added after the cursors position. Again press Esc to leave insertion mode. x is for deleting the letter under the cursor. v is for entering visual mode. To highlight something, what you do in windows editors by pressing shift and the arrows, or by using the mouse if you want to copy a sequence of letters. Then with d you cut the highlighted part, with y you copy the highlighted part, with p you past it. r is for replacing, dd is for deleting an entire line, :q is for quitting, :q! is for quiting without saving, ZZ or :wq is for save and quit :open is for opening files :new is for opening a empty new file. if you type :765 the cursor will move to line 765. There are really a lot more commands and features (for advanced searching, for highlighting a source code). Those are just the basics... If you learn to use vi you'll love it, but it's pretty frustrating in the beginning.

Last edited by perfect_circle; 03-11-2005 at 06:24 AM.
 
Old 03-11-2005, 06:16 AM   #12
frrossk
Member
 
Registered: Feb 2005
Location: UK
Distribution: Debian jessie
Posts: 33

Rep: Reputation: 16
Check out this link: http://www.eng.hawaii.edu/Tutor/vi.html
 
Old 03-11-2005, 06:19 AM   #13
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
I've been using vi for years and you've just lost me!
 
  


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
How do I open a text editor in a shell terminal? alex1986 Linux - Newbie 9 11-30-2005 03:52 PM
Looking for GUI Shell Scripting Editor L1nu*M0m Linux - Software 3 06-08-2004 07:54 PM
how to make an editor do as emacs's shell mode does? icoming Programming 2 05-21-2004 09:50 AM
Text editor in RH9 shell? deWin Linux - Newbie 15 03-07-2004 12:30 AM
which one is the best open source html editor? randomx Linux - Software 6 05-01-2003 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:37 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