Basic Linux commands for beginners

Scenario:- What are some of basic commands one should know when moving from windows enviornment to linux(say ubuntu)?

Solution:- Its a learning experience when moving from mouse click(windows) to terminal evniornment(ubuntu)
We are trying to cover some the very basic commands, please feel free to add more from experience as comments to this post, as its said
If you want to lift yourself up, lift up someone else ..

1.Sudo(Run as adminstator in windows) – sudo command executes a command with administrative privileges (root-user administrative level), which is necessary
example sudo mkdir test 

mkdir ubuntu

2.mkdir(new folder), creates new working directory in the selected location 

3.pwd, tells the current working directory

4. ls, list all the files in the given folder 

5.ll, another form of listing the items try it out

6.Editing a file :-

  • Open file sudo vi filename
  • press ESC
  • press i (for inserting values into file)
  • move cursor the position where editing need to be done
  • edit
  • type :wq (to write and quit the file after saving)
7.Change to root user, sudo -s
8.Rename a file by using move, sudo mv “oldfilename” “new file name”
9.clear, for clearing the terminal
10. Most important how to launch terminal, press ALT+SHIFT+T
11.How to open new tab in terminal, CTRL+SHIFT+T
12.Get to know the existing used commands in terminal, use history in terminal 
history command in linux

13.Launch background screen when remote into linux box using ssh
For example we used ssh userName@IP to remote into linux box, now we want to run an new terminal instance apart from the login window instance. We can use “screen -R Name” command to achieve this.
a)We can shift to main terminal by “CTRL+SHIFT+A” than press “D”.
b) Move back to secondary terminal any time even our original session is broken by screen -R terminalName
c)list all the present screens, screen -ls 
d)kill the instance of screen
screen -X -S screenId kill

kill screen instance in linux

14.How to move directory from local machine to remote machine?
Using secure copy command as below
scp -r ./localpath remoteuser@remoteIP(
-r means recursive copy

15.How to check the file system size in human readable form?
df -h 

16. How to search a given file in all the computer directories?
find / | grep filename 

17. Check that given process is running?
ps ax | grep processname

18.Open the big file to show only last 100 lines?
tail -n 100 filename

19.Open a given file showing the updated view each time when new content is appended?
tail -f filename

20. Download code or file directly from given server?

21.Change file permission for folder for given user?

chown userName -R folderName

22. How to check application running on given port?
lsof -i :portNo
lsof -i :3000

23.Findfile with given extension (mac terminal)?

find ~ -type f -name ‘*.log’
24. Change ownership permissions for all folders insides current directory?
chown -R ownerName:groupName .

Leave a Reply

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