Sunday 9 December 2018

Basic Knowledge - helpful commands

Basic Helpful Commands

// change dir
cd
// list files
ls
// change permission of owner, group and other
chmod 777 ( 7 -> read 4 + write 2 + Execute 1)
// mv files
mv filea ../../file2
// mv folder including all files in folder
mv -r folder1(current dir)  ../../folder2

// Relative paths:
../ (one level up of current directory) 
/file_a (file a in the current directory

// absolute path (Starting from root directory cd /)
/blab/bla/folder1/file2.pho

// Go to root dir
cd / (contains /var/www/html (usually the default document root folder for the server, /home/users etc)

// Go to home
cd ~

// Delete file 
rm file1

// Delete all file in folder
rm -rf folder1

// Output contents of file
cat file1

// rename a file(output content of file and write to another file)
cat file1 > newfiel1


// append to file
cat file1 >> file2


// Symbolic link (force create)
ln -sfn /opt/foo /usr/bin/bar




No comments:

Post a Comment