There are some Ubuntu commands we use very frequently and its harder to remember these all. To avoid searching over the net i am writing those down here precisely for reference so that i can have a look at it anytime.
1. Setting file permissions to 664 recursively -
$ find . -type f -exec chmod 664 {} \;
2. Setting folder permissions to 775 recursively -
$ find . -type d -exec chmod 775 {} \;
3. Delete files folders recursively -
$ rm -rf folderName
4. Search for a "string" in your system -
$ grep -nr "string"
5. Generating An ISO file From A Folder
$ mkisofs -o image.iso -R /path/to/folder/
$ mkisofs -o image.iso -R $HOME (for home directory)
6. Download and extract Tar file in a command
$ wget url-to-tar-file -O - | tar xfz -
$ wget http://website.com/project/tarFile_4.7.tar.gz -O - | tar xfz -
I also prefer dtrx to unzip files. Because with a single command you can unzip any zipped file format.
To install that use this command
$ sudo apt-get install dtrx
7. Killing a halted process
Top command to list down all process with its id.
$ top
$ kill -SIGKILL procesid
Or we can use this command below as well
$ kill -SIGTERM procesid
8. Symlink through command
To create a symlink at /foo/bar which references to file /usr/bin/bar use this command below
$ ln -s /usr/bin/bar /foo/foo
9. Reading file say error log of Apache webserver
$ tail -f /var/log/apache2/error.log
10. Export Import mySql data file -
$ mysqldump -u root -p password databaseName > database_filename.sql
Many more to add ...
1. Setting file permissions to 664 recursively -
$ find . -type f -exec chmod 664 {} \;
2. Setting folder permissions to 775 recursively -
$ find . -type d -exec chmod 775 {} \;
3. Delete files folders recursively -
$ rm -rf folderName
4. Search for a "string" in your system -
$ grep -nr "string"
5. Generating An ISO file From A Folder
$ mkisofs -o image.iso -R /path/to/folder/
$ mkisofs -o image.iso -R $HOME (for home directory)
6. Download and extract Tar file in a command
$ wget url-to-tar-file -O - | tar xfz -
$ wget http://website.com/project/tarFile_4.7.tar.gz -O - | tar xfz -
I also prefer dtrx to unzip files. Because with a single command you can unzip any zipped file format.
To install that use this command
$ sudo apt-get install dtrx
7. Killing a halted process
Top command to list down all process with its id.
$ top
$ kill -SIGKILL procesid
Or we can use this command below as well
$ kill -SIGTERM procesid
8. Symlink through command
To create a symlink at /foo/bar which references to file /usr/bin/bar use this command below
$ ln -s /usr/bin/bar /foo/foo
9. Reading file say error log of Apache webserver
$ tail -f /var/log/apache2/error.log
10. Export Import mySql data file -
$ mysqldump -u root -p password databaseName > database_filename.sql
$ mysql -u root -p password -h localhost databaseName < database_filename.sql
Many more to add ...
No comments:
Post a Comment