Basic Linux commands for beginners – User friendly Tech help
Scenario:- What are some of basic commands one should know when moving from windows enviornment to linux(say ubuntu)?
n
Solution:- Its a learning experience when moving from mouse click(windows) to terminal evniornment(ubuntu)
n
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
n
If you want to lift yourself up, lift up someone else ..
n
1.Sudo(Run as adminstator in windows) – sudo command executes a command with administrative privileges (root-user administrative level), which is necessary
nexample sudo mkdir test
n
2.mkdir(new folder), creates new working directory in the selected location
n
n3.pwd, tells the current working directory
n
n4. ls, list all the files in the given folder
n
n5.ll, another form of listing the items try it out
n
n6.Editing a file :-
n
- n
- 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)
n
n
n
n
n
n
n
7.Change to root user, sudo -s
n
8.Rename a file by using move, sudo mv “oldfilename” “new file name”
n
9.clear, for clearing the terminal
n
10. Most important how to launch terminal, press ALT+SHIFT+T
n
11.How to open new tab in terminal, CTRL+SHIFT+T
n
12.Get to know the existing used commands in terminal, use history in terminal
13.Launch background screen when remote into linux box using ssh
nFor example we used ssh [email protected] 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.
na)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
n
c)list all the present screens, screen -ls
nd)kill the instance of screenn
screen -X -S screenId kill
n
n
14.How to move directory from local machine to remote machine? Using secure copy command as below
n
scp -r ./localpath [email protected](10.0.0.34):/home/remotepath
n
n-r means recursive copyn
15.How to check the file system size in human readable form?
ndf -h
n
16. How to search a given file in all the computer directories?
nfind / | grep filename
n
17. Check that given process is running?
nps ax | grep processname
n
18.Open the big file to show only last 100 lines?
ntail -n 100 filename
n
19.Open a given file showing the updated view each time when new content is appended?
ntail -f filename
n
20. Download code or file directly from given server?
nwget https://jmeter-plugins.org/downloads/file/ServerAgent-2.2.1.zip
n
n21.Change file permission for folder for given user?
n
chown userName -R folderName
n
22. How to check application running on given port?
nlsof -i :portNo
nlsof -i :3000
n
n23.Findfile with given extension (mac terminal)?
n
find ~ -type f -name ‘*.log’
n
24. Change ownership permissions for all folders insides current directory?
n
chown -R ownerName:groupName .
n