UBUNTU BASIC COMMANDS
1. echoing data:
syntax: echo name(variable).
returns the value of the variable
syntax: man command
this will give us the syntax and options available in UNIX.
3. searching a particular file:
syntax: find -name "tools.jar" print 2>/dev/null
searches for the file "tools.jar" based upon the name and if not found returns error msg 2 and so we redirect it using ">" to the /dev/null directory.
4. pipe symbol:
syntax: process1 | process 2
the pipe symbol "|" is used to provide the output of one process as the input to the other process
eg. ls -l | wc : here 'ls -l' returns the list of files within the directory and we provide this as the input to the second process 'wc' (wordcount). thus returning the word count of the list of files .
syntax: tee option filename
read from standard input and write to standard output and files
syntax: source folder_name
to get the required created variables from the specified folder.
7. ls command to list the files in the directory.
8. cat command to view the existing file.
Syntax: cat /etc/list.txt
9. vi command to edit a file
Syntax: vi filename
10. Nano: Another editor to edit files.
11. mv command: to rename/move files from one location to another.
mv oldfile newfile
12. rm command:removing files (deleting)
syntax: rm filename
rmdir : removing directories
syntax: rmdir directory
13. chmod : change file access permissions.
eg: chmod 755 file.txt
has a 10 digit binary code.
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
14. chown - change file owner and group
chown [OPTION] OWNER[:[GROUP]] FILE
chown [OPTION] :GROUP FILE
chown [OPTION] --reference=RFILE FILE
15. cp - Copy files
syntax: cp myfile yourfile
16 cd - to navigate into files
syntax: cd foldername/foldername/file