This is easy and sometimes needed.
Code:sudo touch /forcefsck
Printable View
This is easy and sometimes needed.
Code:sudo touch /forcefsck
Nice tip...making a simple script into a /usr/bin file for easy access.
Will this just check the filesystem or prompt to fix/repair any problems? If not, how would you go about fixing if problems were reported?
Nice tip however. Thanks
If it finds problems a command line appears and you have to enter some sommand I don't remember, but it was somethign like fsck -f /dev/hdaX or something like it. You can use man fsck to check, but it depends on the error it finds...Quote:
Originally Posted by kittcankitt
I'm learning how to wright scripts, and used this command as one of my first lesions. Here's how I've setup a shortcut using this command:
- make a directory in your home directory named "bin".
(most of us have done this already)
- right click and create a "new file", name it "checkfs.sh"
- open this file in gedit, and add the lines:
sudo touch /forcefsck
sudo reboot
-save this file.
- How in your user home dir. go to the view menu and select "show hidden files"
- locate the ".bashrc" file. This is where you can add aliases to your scripts. About the middle of this file is a section that already has some useful aliases. Add this alias to that section:
#beginning user added aliases
alias restart='sh /home/dale/bin/checkfs.sh'
note: I added the comment (# bla bla bla) so I can find
all the changes I've made easy. It's a good idea in case
you break somethnig down the road.
-save this file.
Now open a thermal or the run command and type "restart". you'll be asked for the root password, then be logged out, and reboot with the fsck. I know this is very sample to a lot of users, but, this little setup spark a whole bunch of scripts I how use on a regularly. It was kinda like my own "hello world".
isn't
a lot easier than the sh file?Code:alias restart='sudo touch /forcefsck && sudo reboot'
I'd rather do all my customizations in a separate file.
Here is an example of a mybashrc file in your ~/bin directory:
http://ralf.beckesch.de/download/dev/bash/mybashrc
To call it, you would just add this to your .bashrc:The reason why you would do that is that on large systems, on upgrades, the admin would push a new .bashrc file into your home directory, making you lose your customizations. Although ubuntu might not be doing that, I still think it's a good idea.Code:#if [ -e ~/bin/mybashrc ]; then
. ~/bin/mybashrc
fi
Besides, the existing .bashrc contains the following as a suggestion:Code:# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
this didn't work. i made it check both my / and /home partition. (you guys should really be using separate partitions for home, I do that in linux and windows), but it didn't fix either of them.