sudo vi /etc/rc2.d/S01autorun sudo vi /etc/rc2.d/S99vautorunThe proper way would be to add a line to rc.local
sudo vi /etc/rc.localEnd with an ampersand to background the process and allows the rc.local to continue executing
sudo vi /etc/systemd/system/[name].service
sudo vi /etc/cron.d/[name]
sudo vi /etc/profile/etc/bash.bashrc is system wide, will run when logging in to console or opening a terminal
sudo vi /etc/bash.bashrc~/.bash_profile is run when logging in using the console
vi ~/.bash_profile~/.profile is run on a gui login
vi ~/.profile~/.bashrc is run when a (non login) terminal is opened in the gui
vi ~/.bashrc
for xfce: when you configure startup scripts via the UI, then a file will be created in
~/.config/autostartcan of course create such a file manually
sudo vi ~/.config/autostart/[name].desktopexample
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=autostart Comment=autostart Exec=/data/startlog ~/.config/autostart/autostart.desktop OnlyShowIn=XFCE; StartupNotify=false Terminal=false Hidden=false
[root] rc2.d/1 [root] /etc/profile [root] /etc/rc.local [root] /etc/init.d/rc.local [root] rc2.d/99console login
[user] /etc/bash.bashrc [user] /etc/profile [user] /home/[user]/.bash_profilegui login
[user] /etc/profile [user] /home/[user]/.profile [user] ~/.config/autostart/autostart.desktopopen terminal in gui
[user] /etc/bash.bashrc [user] /home/[user]/.bashrc
creating a new service
sudo vi /etc/init.d/<service name> sudo chmod 700 /etc/init.d/<service name> sudo update-rc.d <service name> defaults sudo update-rc.d <service name> enable
initctl list service --status-allcreate a new script file in /etc/init.d
#!/bin/sh # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 DESC="test script" NAME="test one" start() { echo "starting!"; } stop() { echo "stopping!" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "usage: \n service @identifier@ (start|stop|restart)" esac exit 0apply changes
initctl reload-configuration
http://upstart.ubuntu.com/cookbook/ http://manpages.ubuntu.com/manpages/precise/man5/init.8.html http://manpages.ubuntu.com/manpages/precise/man5/init.5.html
sudo vi /etc/systemd/system/[name].service [Unit] Description=Job that runs your user script [Service] ExecStart=/some/command Type=oneshot RemainAfterExit=yes [Install] WantedBy=multi-user.targetapply changes
sudo systemctl daemon-reload sudo systemctl enable foo.serviceYou can run multiple commands from the same service file
[Service] ExecStart=/some/command ExecStart=/another/command some args ExecStart=-/a/third/command ignore failureWantedBy used here, for example, makes it start when the multi-user.target is reached. You can use Before, After, Requires, etc.
https://wiki.ubuntu.com/SystemdForUpstartUsers http://manpages.ubuntu.com/manpages/zesty/en/man5/systemd.unit.5.html https://www.freedesktop.org/software/systemd/man/systemd.exec.html https://www.freedesktop.org/software/systemd/man/systemd.service.html https://www.freedesktop.org/software/systemd/man/systemd.unit.html https://www.freedesktop.org/software/systemd/man/systemctl.html https://www.freedesktop.org/software/systemd/man/journalctl.html
echo $PATH echo $PATH | tr ':' '\n'extending the path for this terminal session
PATH="$PATH:/tmp/bin"store the line above in ~/.profile to make it permanent (requires restart)
echo 'PATH="$PATH:~/opt/bin"' >> ~/.profileto use modified path this session without restarting
. ~/.profile
shutdown -r now sudo systemctl rebootshutdown
shutdown -h now sudo systemctl poweroffsuspend to RAM
sudo systemctl suspendhibernate
sudo systemctl hibernatesuspend with hibernate as a backup (in case power runs out anyway)
hybrid-sleep
https://i.stack.imgur.com/BlpRb.png http://manpages.ubuntu.com/manpages/disco/en/man7/hier.7.html https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/