Scarica Comandi base di linux e più Esercizi in PDF di Sistemi Operativi solo su Docsity!
Basic Unix Commands
Bash Commands
man o Shows manual for a command.
sudo o Execute a command as the superuser.
File System Navigation
cd o Change current working directory.
ls [] [] o List the contents of a directory (current working directory by default). o Options: -l: use a more detailed listing format. -a: show hidden files and folders.
pwd o Print name of the current working directory.
File System Manipulation
mkdir o Create a new directory, if it does not already exist..
rmdir o Remove a directory, if it is empty.
mv o Move (rename) the file to .
rm [] o Remove a file. o Options: -R: remove directories and their contents recursively.
cp [] o Copy the file to . o Options: -R: copy directories and their contents recursively.
ln [] o Create an hard link to file in . o Options: -s: make symbolic links instead of hard links.
Process Management
ps [] o List active processes.
o Options: -e: list all processes. -l: use a more detailed listing format.
top o Show a a dynamic real-time view of running processes.
kill - o Send the signal to the process specified by . o Signals: -9: terminate a process.
& o Execute command in background.
File Operations
cat o Print file on the standard output.
more / less o Print file on the standard output page by page.
sort [] o Sort lines of text files (alphabetically by default). o Options: -r: reverse order. -n: use numerical order. -k : sort via key.
cut [] o Remove sections from each line of a text file. o Options: -f <field1,field2,...fieldN>: specify fields to select. -d : use instead of TAB for field delimiter.
tr [] [] o Translate standard input characters from to . o Options: -d: delete characters from instead of translating them.
uniq [] o Omit repeated lines. o Options: -d: report only repeated lines instead of omitting them.
grep [] o Print lines of a file matching a pattern.
recursively.
String manipulation
basename path o Strip directory and suffix from path.
dirname path o Strip last component from path.
Redirections
cmd1 | cmd o Redirect standard output of cmd1 to standard input of cmd2.
cmd < file o Redirect standard input of cmd from file.
cmd > file o Redirect standard output of cmd to file. cmd 2> file o Redirect standard error of cmd to file.
cmd &> file o Redirect standard output and standard error of cmd to file.
cmd >> file o Append standard output of cmd to file.
Shortcuts
CTRL+C o Terminate the current foreground process.
CTRL+Z o Stop the current foreground process.
TAB o Autocompletion.