Performing basic commands in Ubuntu Server

Here are list of 10 very basic commands that can be used to create, edit, copy text in a linux command line.

1. For getting superuser access: sudo su command is used

   [email protected]:~$ sudo su -> it asks for the user login password. A super user has all the permissions to do administrative tasks.

2. For Switching directories: cd command is used

for example:

[email protected]:~$ cd /     -> switches to the root directory

[email protected]:/$  cd home  -> switches to the home directory

3. For listing the directories and file structures: ls command is used

[email protected]:~$ ls

Ubuntu Server

learn more about the directory tree in ubuntu here

 

 

4.  Display message on screen: echo command is used

echo

5. Display the contents of a file: cat command is used.

cat

 

 

 

5. Echo some text directly into a new text file: for eg. echo “Hi there. This is a new file” > hello.txt

echoandcat

 

 

 

6. To append text into an existing file. for eg. echo “This text is appended” >> hello.txt

appended

 

7. Copy the text of one file to another 

cat textfile1.txt >> textfile2.txt

copy

 

 

 

 

8. Open a file in a text editor: vi hello.txt opend up hello.txt in a new text editor window.

vi

You can use the editor to insert and edit text in the file.

 

 

 

 

 

 

9. Some commands to use inside the text editor

Press Esc -> dd     -> it deletes the current line

Press Esc-> u      -> it undo’s the previous action

Press Esc -> yy p   -> copies the current line

Press : w    -> saves the current file

Press : wq  -> saves and exits the current file

Press : q!   -> discards changes and exits the file.

10. Some useful links to learn more about linux command line

How to install ubuntu server: blog(wikihow)

list of commands: here

linux how to and tips: here

ubuntu help site: here

 

Leave a Comment

Your email address will not be published. Required fields are marked *