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

   rachhek@ubuntu:~$ 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:

rachhek@ubuntu:~$ cd /     -> switches to the root directory

rachhek@ubuntu:/$  cd home  -> switches to the home directory

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

rachhek@ubuntu:~$ ls

Ubuntu Server

learn more about the directory tree in ubuntu here



4.  Display message on screen: echo command is used


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





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





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



7. Copy the text of one file to another 

cat textfile1.txt >> textfile2.txt






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


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 *