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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-10-2005, 01:28 PM
|
#1
|
Member
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213
Rep:
|
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.
|
|
|
03-10-2005, 01:37 PM
|
#2
|
Senior Member
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313
|
Yes put the name of the editor before the filename you wish to open.
|
|
|
03-10-2005, 01:42 PM
|
#3
|
Member
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213
Original Poster
Rep:
|
Thanks .. Just to know what is the common text editor for linux? Meaning that I will find in every machine.
|
|
|
03-10-2005, 02:03 PM
|
#4
|
Member
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410
Rep:
|
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".
|
|
|
03-10-2005, 02:22 PM
|
#5
|
Senior Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783
Rep:
|
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.
|
|
|
03-10-2005, 03:47 PM
|
#6
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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)
|
|
|
03-10-2005, 05:22 PM
|
#7
|
LQ Newbie
Registered: Mar 2005
Distribution: Fedora Core X
Posts: 6
Rep:
|
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.
|
|
|
03-10-2005, 05:41 PM
|
#8
|
Member
Registered: Sep 2002
Distribution: Mandrake 10.0 O
Posts: 48
Rep:
|
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
|
|
|
03-11-2005, 12:57 AM
|
#9
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443
|
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...
|
|
|
03-11-2005, 01:49 AM
|
#10
|
Member
Registered: Mar 2004
Distribution: Slackware 10.2
Posts: 213
Original Poster
Rep:
|
With the vi I can only view the file, I need to edit it as well.
|
|
|
03-11-2005, 04:58 AM
|
#11
|
Senior Member
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783
Rep:
|
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.
|
|
|
03-11-2005, 06:16 AM
|
#12
|
Member
Registered: Feb 2005
Location: UK
Distribution: GalliumOS
Posts: 33
Rep:
|
|
|
|
03-11-2005, 06:19 AM
|
#13
|
Member
Registered: Sep 2003
Location: Manchester UK
Posts: 264
Rep:
|
I've been using vi for years and you've just lost me!
|
|
|
All times are GMT -5. The time now is 05:50 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|