Hi devs in this article we are going to see most important commands offered by linux. You can improve your productivity using these linux commands. Lets see what linux has to offer.
uname -a
find . -name Resident.php
find / -type d -name 'folder name'
So here we are moving "laravel.log" file from logs folder to test folder.
find logs -maxdepth 1 -name "laravel.log" -exec mv {} test \; find logs -name 'laravel.log' -exec sh -c 'mv "$@" test' find-sh {} + // Moving back to logs folder find storage/test -maxdepth 1 -name "laravel.log" -exec mv {} storage/logs \;
find folderName -name fileName -exec sh -c 'mv "$@" FolderNameWhereYouWantToMove' find-sh {} +; // This will search file "fileName" under "folderName" directory and then will move to "FolderNameWhereYouWantToMove" folder
echo write something to file.txt | cat > file.txt
echo -e write something to file.txt >> file.txt // will add "write something to file.txt" string in "file.txt" file.
> file.txt // will remove the content of file.txt
> file.txt && echo -e write something to file.txt >> file.txt // Here first we are empty a file and then add a string in it // so 2 commands run 1st : > file.txt // clears the file 2nd : echo -e write something to file.txt >> file.txt // adds "something to file.txt" to file
cat file.txt file1.txt > 0.txt // will add content of file.txt and file1.txt and put in new file 0.txt
mv storage/test/* storage/logs/
mkdir -p test/{0..4}
Here command will create folders inside "test" folder. as we mentioned {0..4} we will see 5 folder from 0,1,2,3,4.
rm -rf test/*
This command will remove all files and folders from "test" folder.