Saturday, June 12, 2010

MY LINUX NOTES

  • Create your user account on the server
    • ssh –l root 10.0.3.***
    • yes
    • linuxlinux
    • useradd sgarcia
    • passwd sgarcia
    • famous2007
    • usermod –c 'Sommer R. Garcia' –G wheel sgarcia
  • Edit your .bashrc
    • exit
    • ssh –l sgarcia 10.0.3.***
    • famous2007
    • vi ~/.bashrc
    • "Insert"
    • PATH=$PATH:/sbin:/usr/sbin
    • "ESC"
    • :wq
  • Create new group
    • exit
    • ssh –l sgarcia 10.0.3.***
    • famous2007
    • sudo groupadd Growers
  • Create new directory
    • sudo mkdir /'Company Data'/'Plant Farmers'
  • Give group permissions on a directory
    • sudo chgrp Growers /'Company Data'/'Plant Farmers'
    • chmod 775 /'Company Data'/'Plant Farmers'
  • Crete new user
    • sudo useradd tblack
  • Create password for new user
    • sudo passwd tblack
    • chum
  • Add details to new user
    • sudo usermod –c "Tinsi D. Black" –G Growers tblack
  • Create a symbolic link
    • sudo ln –s /'Company Data'/'Plant Farmers' /home/tblack/Work
  • Create permanent alias for new user
    • sudo vi /home/tblack/.bashrc
    • "Insert"
    • alias goto="cd ~/Work"
    • "ESC"
    • :wq
  • Create folder in new user's home directory
    • sudo mkdir /home/tblack/Scripts
  • Change owner of new directory
    • sudo chown tblack /home/tblack/Scripts
  • Change group of new directory
    • sudo chgrp tblack /home/tblack/Scripts
  • Edit user's .bashrc with new path
    • sudo vi /home/tblack/.bashrc
    • "Insert"
    • PATH=$PATH:~/Scripts
    • "ESC"
    • :wq
  • Create executable in user's home directory
    • sudo vi /home/tblack/thescript
    • "Insert"
  • clear
  • echo "
  • insert 5 lines
  • Hello! This is my File making script.
  • insert 5 lines
  • What would you like to call the file?"
  • read INPUT
  • touch ~/"$INPUT".txt
  • clear
  • ls –l ~
  • "ESC"
  • :wq
  • Change owner of the script
    • sudo chown tblack /home/tblack/thescript
  • Change group of the script
    • sudo chgrp tblack /home/tblack/thescript
  • Make the script executable to the owner
    • sudo chmod 775 /home/tblack/thescript
  • Find a hidden file
    • sudo find / -name "answer.log"2>/dev/null
  • Output tail
    • sudo tail -1 /lib/udev/devices/Secret/answer.log 1>/~/Found_Tail.txt
  • Output head
    • sudo head -2 /lib/udev/devices/Secret/answer.log 1>/~/Found_Head.txt
  • Output grep
    • sudo grep 'this is the line' /lib/udev/devices/Secret/answer.log 1>/~/Found_Grep.txt
  • Extra Credit
    • cd /~
    • vi EXTRA
    • "Insert"
  • clear
  • echo "
  • insert 5 lines
  • Check out my awesome Extra Credit Script!!!!!
  • insert 3 lines
  • Allow me to create and display a file for you.
  • insert 3 lines
  • Please type the word Credit"
  • read INPUT
  • touch ~/"$INPUT".txt
  • cat ~/Found_Head.txt >> ~/"$INPUT".txt
  • cat ~/Found_Grep.txt >> ~/"$INPUT".txt
  • cat ~/Found_Tail.txt >> ~/"$INPUT".txt
  • clear
  • cat ~/"$INPUT".txt
  • "ESC"
  • :wq
  • sudo mkdir /~/Scripts
  • sudo mv /~/EXTRA /~/Scripts
  • sudo chmod 775 /~/Scripts/EXTRA
  • sudo vi /~/.bashrc
  • "Insert"
  • PATH=$PATH:/sbin:/usr/sbin:/~/Scripts
  • "ESC"
  • :wq
  • exit

    Now log back in as yourself and type the word EXTRA to run the executable file.
    Relax. You are done!

No comments:

Post a Comment