please dont rip this site

Linux Documentation

Basic commands:
 

man -k subject
Find commands related to a subject. The command for finding the command
uname -a
Info about the os, kernel, name of the computer, processor, etc... might not mention the distribution your running. To find out what distribution of linux your running (Ex. Ubuntu) try lsb_release -a or cat /etc/os-release
mkdir folder
“Make Directory”, make a new folder under the current folder
cd folder
“Change Directory” go into a folder under this folder. To go up, cd ..
To go to the root folder, cd /
nano filename
Start the "nano" editor which is included with most Linux distributions. It uses regular commands like the arrow keys, delete, backspace, etc... In Nano:
ctrl+o
Output a file... this is SAVE not open.
ctrl+x
eXit

To select text in nano, move the cursor to the start of the text you want to select, press the Alt-A key combination to mark the start, then move the cursor to the end of the section you want to select. press Ctrl+K to cut your selection and Ctrl+U to paste it.

sync
Flush all files from RAM into the drives. Not normally needed, but is safer if you regularly power off without shutdown, as with embedded systems.
ls
List files in the current directory. Does NOT find. Use ls -l to see file permissions, size, etc...
ls -d -1 -l --time-style="+%Y-%m-%d@%H:%M:%S" /path/** shows the files in the current directory, one file per line, including permissions, group, owner, size, date (year-mm-dd@HH:mm:ss), and full path/filename. To show the current folder, replace /path with "$PWD"
find -name filemask
Find files in the current directory or below whose names match filemask. Does not search file contents. e.g. find -name *.js
find . -type f -exec ls -lrt --time-style=full-iso {} +
Search files below this folder, including sub folders, and order ALL of them by modified date, displaying the FULL modified date.
grep -Rine 'pattern'
grep -Rinwe 'pattern 'folder/'
Search for files in the specified directory or below (-R is recursive) whose contents match the pattern. -i ignores case, -n displays the line number in the file where the pattern is found. The -e pattern is a regular expression. -w matches whole words only. --include=filemask can be added to filter the file names searched.
mv file file
Rename or move a File. Note: Renaming a file is nothing more than moving it from it's old name to it's new name.
rm file
Remove a File.
rm -r folder
Remove a Directory.
df -H
Show the local hard drives with space in GB, etc...
shutdown -r now
Restart
Control-Z
Stops the foreground job and places it in the background as a stopped job
jobs
Lists all jobs
bg %n
Places the current or specified job in the background, where n is the job ID
fg %n
Brings the current or specified job into the foreground, where n is the job ID
dmesg | grep parport (for PCIe)
lspci -v (for PCI)
Find the addresses of parallel ports on your system.
blkid
List all the block devices (e.g. hard drives) and their partitions with type, label, etc...
curl -L -v -o filename url
Download a file or web page from the internet. The -L specifies that it should follow re-directs, the -v shows you what is going on, the -o specifies a file to write the output into and the url is the location to go get the data from; a web page address, or file, or whatever.
tar -xvzf filename.tar.gz -C folder
Extracts the archive to the folder. Flags:
-x tar can collect files or extract them. x does the latter.
-v makes tar talk a lot. Verbose output shows you all the files being extracted.
-z tells tar to decompress the archive using gzip
-f this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
-C extract into a custom folder
tar -zcvf filename.tar.gz folder
Compress the folder (and all under it) to the filename. Flags:
-z: Zip. Compress using gzip
-c: Create file (output tar.gz file)
-v: Verbose display the progress while creating the file
-f: File; path of the desire file/directory to compress
sudo adduser $USER dialout (Ubuntu specific)
To allow programs run by the user to access the serial port. To find the serial device, ls /dev/tty* then plug in the device and do that again. The difference is the device.

Assuming you have a version of linix which supports apt-get, you can make sure everything is up to date with:
sudo apt-get update
sudo apt-get upgrade

From the shell, if you want to let a program continue to run in the background, just hit Ctrl+Z. Or you can start the command with a "&" at the end. E.g. node httpd.js & to start your node.js web server. To see the jobs you have in the background, type jobs and to bring one back to the foreground, use fg  jobno which defaults to job number 1.

Linux Command line Serial Communications +

See also

sshfs: Edit Files on remote Google Compute or other Linux system

Let's say you fire up a (totally free forever, as long as you don't use too many resources) f1 google compute engine (easy, lots of docs online) and you want to edit your files on that drive. You can do it with nano, vi, whatever after you log in, but wow that gets old. Be nice to have a real editor like VSCode, or Atom, or emacs or whatever. So you can copy files back and forth to your local machine... or... on your local Linux box,

sudo apt-get install sshfs

ssh-keygen -t rsa -f ~/.ssh/ -C username

Note that is your username on the /remote/ system, not local. Enter a passphrase. This will make

In the compute engine, search for "metadata", switch to the SSH tab, Edit, add, copy in the contents of the .pub file, then save.

To test, and make sure it worked:
ssh -i ~/.ssh/keyfile username@externalip
then exit or open another terminal window, and:

sshfs -o allow_other,reconnect,ServerAliveInterval=120 -o IdentityFile=~/.ssh/keyfile username@externalip:start-folder-on-remote start-folder-on-local

It will ask you for the pass phrase the first time.

unmount

sudo fusermount -u start-folder-on-local

if it says the device is busy, try
sudo fusermount -zu start-folder-on-local

The start-folder-on-local has to be a place you own. You can't use /mnt because then you have to run sshfs as sudo and then you can't write to the files. Just make a mnt folder under /home and use that.

See also:

Amazingly enough, making a desktop shortcut icon is NOT included in the GUI on Ubuntu 18 and 20. Make a file called something.desktop, open it in gedit and type:

[Desktop Entry]
Name=Launcher Name
Comment=Launcher Comment
Exec=Command to Execute
Terminal=false
Type=Application
Icon=Path to Icon
sudo cp your file to /usr/share/applications and when you run it right click the app in the Unity Launcher and tick "Keep in launcher" (if you want it in the Unity Launcher), or just put it on your desktop if you want a Desktop launcher. Put this file in ~/.local/share/applications if you want to only apply this to your user. +
file: /Techref/os/linux/docs.htm, 12KB, , updated: 2022/10/6 10:12, local time: 2024/11/23 01:56,
TOP NEW HELP FIND: 
18.191.162.73:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/techref/os/linux/docs.htm"> Linux Documentation</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .