Version 7 (modified by 5 years ago) ( diff ) | ,
---|
File Editing Example
After our last example you should have a file name alphabet.txt. Let's use the nano editor to alter the contents of this file.
- Navigate to the directory containing alphabet.txt
- Open the file
[tulaneID@cypress1]$ nano alphabet.txt
- Add the line Now I know my ABCs to the end of the file
- Hold control (^) and press the "x" key.
- Type "y" for yes
- Press enter/return to keep the same name or enter a new name for the file
You should now be back on the the command line. Use the tail command to check if your changes were saved.
Challenge
- Create a new file named helloworld.c that contains the following text
#include<stdio.h> int main(){ printf("Hello World\n"); return 0; }
- Compile the above text using the following command
[tulaneID@cypress1 ~]$ gcc helloworld.c -o helloworld
- Check that there's a new executable file name helloworld
Attachments (3)
- nanoExample.png (149.8 KB ) - added by 9 years ago.
- nanoExample2.png (148.2 KB ) - added by 9 years ago.
- nanoExample3.png (168.1 KB ) - added by 9 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.