längs
along
Used as a preposition to describe movement or orientation parallel to the longer side of something; along.
Wir spazierten längs des Flusses.
We walked along the river.

along / lengthwise
Loading your saved state.
along
Used as a preposition to describe movement or orientation parallel to the longer side of something; along.
Wir spazierten längs des Flusses.
We walked along the river.

The word 'längs' (along/lengthwise) is derived directly from the adjective 'lang' (long). It describes an orientation that follows the length of something.
Der Radweg führt längs der Hauptstraße.
The bike path runs along the main road.
You can tell whether 'längs' (along/lengthwise) is a preposition or an adverb from the sentence structure. If it stands before a noun, e.g. 'längs des Weges' (along the path), it is a preposition. If it stands alone and describes an action, e.g. 'etwas längs schneiden' (to cut something lengthwise), it is an adverb.
Wir sind längs der Küste gewandert.
We hiked along the coast.
As a preposition, 'längs' (along) takes the genitive in standard German. In colloquial speech, however, the dative is very often used.
Längs des Zaunes wachsen viele Blumen.
Many flowers grow along the fence.
As an adverb, 'längs' (lengthwise) is often used in instructions to describe the direction of an action. Common verbs are 'schneiden' (to cut), 'falten' (to fold), or 'teilen' (to divide).
Der Tischler sägte das Brett längs durch.
The carpenter sawed the board lengthwise.
along
'entlang' and 'längs' can both express that something runs parallel to a line, road, wall, or river. 'entlang' is very common in everyday language, especially for movement: you walk 'die Straße entlang' (along the street) or 'entlang des Flusses' (along the river). 'längs' can be used similarly as a preposition, but it often sounds a bit shorter or more written. In addition, 'längs' can also mean, as an adverb, that something lies or is cut lengthwise. The words can be confused because both have to do with direction and length. As a simple guide: for a path next to something, 'entlang' is usually more natural; for an orientation in the lengthwise direction, 'längs' often fits.

Für den Salat schneidet Anna die Gurke längs in dünne Streifen.
For the salad, Anna cuts the cucumber lengthwise into thin strips.
Wir gehen den Fluss entlang bis zur alten Brücke.
We walk along the river to the old bridge.