02.1 Linux Commands
02.1 Linux Commands
- Create a file
$ touch myfile
$ cat myfile
- Add a new line to file. This will erase the old contents.
$ gedit myfile
First Name:
Last Name:
House Name:
City :
Landmark :
District :
State :
Country :
Phone.No :
$ ls
$ ls -l
$ mkdir myfolder
$ cd myfolder
$ pwd
$ cd ..
$ cp myfile address
$ mv address address.txt
$ cp address.txt myfolder/
$ rm myfile
Linux Commands-3
$ rmdir myfolder
$ rm -r myfolder
More commands
--------------
$ ls /
$ ls -a
$ cd ~
$ cp -R myfolder myfolder1
$ ln -s myfile myfile.lnk
The group of 'myfolder' directory is root. With -R, the files and
its subdirectories also changes
to new group bpk.
Note: This is an admin command. Root user only can change the
group of the file or directory.
File Permissions
-----------------
# File Permission
0 none
1 execute only
2 write only
3 write and execute
4 read only
5 read and execute
6 read and write
7 set all permissions (read, write and execute)
$ ls -al
Linux Commands-5
$ mv myfile myfile.txt
- To move a directory
$ mv myfolder myfolder1
Note: This command moves the files myfile and myfile.txt from the
current directory to myfolder.