a directory for everyone brave enough to linux
I don't really understand, why I have to do that, but I think it's related to the reduction of rights.
Merge request reports
Activity
18 18 I'm interested in for a proper worksflow (also outside DigiZeit) is available. If that's the case, great, if not I'll have to look for a workaround. 19 19 20 20 I'll follow up on that tomorrow, as it's getting late. 21 22 Just a little comment before I log off for today: I just accidentally disabled my touchpad in the setting and am now struggling to turn it on again. I guess curiosity killed the cat. Fun times. Welcome to the world of Linux, @henrik.jochum --- it's definitely much easier to break things, since you're given more control of your machine. You'll do a lot more googling in the coming days, but you'll be happy to find that thousands of people will have had all the same questions as you
I think Ubuntu is pretty self explanatory, and there are also many guides online on 'essential' software and so on. Even the Microsoft Teams
.deb
app worked fine for me today! And yeah, I think you've now down the hard part. But do let me know if you get stuck.Oh, and you'll find yourself in the terminal more than before, some apps will need to be installed from the command line ... you'll get used to
sudo apt-get install <package>
in no time. Just so you know,sudo
is a command that gives you more privileges, makes you into a super-user/admin, allowing you to do things to 'system' directories. Don't usesudo
unless you need to though. Try without it, and if you get errors saying 'Permission denied' or similar, then and only then shouldsudo
be the answer. You want to grant yourself admin privileges as rarely as possible, for reasons that will become clear in time
Since you might find yourself inside the Terminal (command prompt) more often on Linux, do try to document which commands you find yourself using, and what they do. You'll probably paste a few in from Google/stack overflow answers. Some of the common commands:
-
ls
-> show contents of directory (ls -alh
, show it more readably) -
cd
-> change directory (learncd /
,cd ~
,cd ..
for moving around using relative, rather than absolute paths to things) -
find
-> print paths to files/folders matching some criteria -
grep
-> use regular expressions to find lines in files that match some search string -
cat <file.txt>
-> print contents of file to terminal -
less <file.txt>
-> print the first part of a file, allowing you to scroll up and down.ctrl+c
to get out -
echo "something"
-> print "something" in terminal -
mkdir my-folder
/touch file.md
-> make new folders/files -
history
-> print my previously entered commands -
apt
andapt-get
-> linux commands for installing packages -
clear
-> clear your terminal screen -
yes
-> keep printing the word yes, truly amazing command -
mv <source-path> <target-path>
-> move a file from source to target -
cp -R <source-dir> <target-dir>
-> copy a directory and its contents recursively to a new location -
rm file.txt
-> delete a file -
rm -r -f <directory>
remove a folder and everything inside it recursively. be careful with this, you couldrm
most of your system by mistake... -
man <other-command
-> show me the manual (i.e. documentation) for another command. Learn to read these man pages, they typically have all the info you need -
ctrl+r
-> find from your command history (really useful, learn to use this one as an instinct!) -
git
-> this one you know!
All programming is, is stringing together a bunch of commands in a file, and then executing that file (i.e. running the script). For example, you could write a nice little script that pulls the latest for every git repository in your home folder. It might look something like:
#!/usr/bin/env bash cd ~ # go to your home folder cd digizeit # go into our repo, assuming it was cloned to ~/digizeit git checkout master # make sure you're on master branch git pull # get latest cd .. # go to parent directory cd <other-project> # some other project you're working on, same thing git checkout master git pull cd ~ echo "Finished! I am now a computer programmer"
The first line of the script, called a shebang, tells your system which language the program is written in (bash, the default language of your terminal). You'd save this as
update.sh
, then you'd tell Linux you want to be able to execute the file with:chmod +x update.sh
You can then do
./update.sh
to run your script. If it prints theFinished
line, it worked, and you're a programmer now. You can even move the file to/usr/bin
, and then you can run it from any directory at any time just by typingupdate.sh
! But, since you're a programmer now, you actually make a repository containing all your cool scripts, and you keep this and other scripts that you write under version control in that repository. That way you can improve it over time, while keeping its history, blah blah.One interesting thing to try:
Open a terminal and use the following command to install telnet:
sudo apt install telnet
And then use this command to watch Star Wars in ASCII art.
telnet towel.blinkenlights.nl
Note, what I've put here shall end up in our wiki as a basic command line tutorial. I will do it eventually unless someone else jumps in ...
Edited by Danny McDonald-
One other thing you'll want to do quite quickly, install Atom and/or Sublime Text, and then set those in terminal as your default editor, so that files are opened for editing using those apps, rather than in the terminal's default (terminal-based) editor (nano or vim, both of which require some practice).
https://askubuntu.com/questions/777410/how-to-set-atom-editor-to-main-editor
These instructions tell you something really valuable, that you can add lines to this
~/.bashrc
file. This file contains your terminal preferences and shortcuts and so on. For example, I add:alias la="ls -alh"
And then do
source ~/.bashrc
to reload the settings. This gives me a new command,la
, which is just the same as doingls -alh
but shorter. So yeah, back to the point, you use this same preferences file to store your preferred text editor, so that when you do things in terminal requiring a text editor, it'll open the file with Atom, much easier than learningvim
right now.mentioned in issue #25