Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to ubuntu and I am trying to create a file to fix a suspend problem I have with my system. I have found the answer here as follows:

Put attached script into dir /etc/pm/sleep.d e.g. with name fglrx-fix and make it executable (chmod u+x /etc/pm/sleep.d/fglrx-fix)

#Script kills autofs when going into standby to eliminate issues with it
case $1 in

#suspending to RAM
    chvt 1
    echo "Going to sleep"
    sleep 1
#resume from suspend 
    echo "try to resume"
    sleep 1
    chvt 7

I just cannot work out how to create the file in terminal, if someone could give a me a step by step instruction that would be great!

share|improve this question
possible duplicate of The fastest way to create a file from a terminal – Radu Rădeanu Apr 1 '14 at 13:05
No, he wants a file with specific content. – guntbert Apr 1 '14 at 20:10

You'd most commonly use a command line editor like nano. You need to run it as root because of where you're trying to write:

sudo nano /etc/pm/sleep.d/fglrx-fix

nano will open up allowing you to paste the code in. Control+X to exit (press Y to confirm that you want to save it and Return to confirm the filename).

Then (per the original instuctions) make it executable with:

sudo chmod +x /etc/pm/sleep.d/fglrx-fix
share|improve this answer
You could also use Text Editor, which is a little bit more user-friendly. To do that you would use the following command: sudo gedit /etc/pm/sleep.d/fglrx-fix ...And after you save and close it (when you close it in Text Editor it will return to your curson in the terminal), you would follow @Oli's instruction to make it executable. – JohnnyCoder Apr 1 '14 at 13:20
I stayed away from graphical options because the problem at hand seems to be a graphical one. nano is universally available and isn't that hard to use :) – Oli Apr 1 '14 at 13:27
Yes, that makes sense - I missed the OP's flgrx, which should have indicated a graphics/display issue to me. :p vi or vim works, too - but you are right, nano will work in the terminal no matter what. – JohnnyCoder Apr 2 '14 at 14:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.